This is is to be coded in microsoft Visual Studios 2013 as a C# Windows Forms pr
ID: 674252 • Letter: T
Question
This is is to be coded in microsoft Visual Studios 2013 as a C# Windows Forms program.
Problem 1 - Retail Price Calculator
You must create a program that can read in a series of values representing the wholesale cost of items and calculating the total retail price value of all those wholesale prices. Retail price is calculated as a percentage of the wholesale price plus the original wholesale price.
The following rules apply to marking up a price of an item:
If an item's wholesale cost is less than $100, its markup percentage is 100%. An item that costs $5.00 would cost $10.00.
If an item's wholesale cost is greater than or equal to $100, its markup percentage is 50%. An item that costs $150 would cost $225.00.
The program must have a method named CalculateRetail that receives the wholesale cost and returns the retail price of the item
The input will come from a text file containing 10 or more random currency values with one value on each line
The output is the total price (wholesale cost + markup) for all the prices in the file and that value is displayed on the form
The input file must be selected using an Open File Dialog
Here is a sample input file
Problem 2 - Prime Numbers
UPDATED: Note the assistance available for this problem (click here).
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace _10_21_Homework2Project2
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void btnGo_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
StreamReader inputFile;
inputFile = File.OpenText(openFileDialog.FileName);
StreamWriter outputFile;
outputFile = File.CreateText(saveFileDialog.FileName);
while (!inputFile.EndOfStream)
{
// read a line of the input file
// call the IsPrime method to decide whether or not the number is prime
// if the result is that the number is prime, write to the output file using the specified format
// if the result is that the number is not prime, write to the output file using the specified format
}
outputFile.Close();
inputFile.Close();
}
}
}
}
}
You must create a program that can read in a series of integers as input from a text file and output a text file documenting whether or not for each of the values in the input file the number is or is not prime. See question 8 of Chapter 6 on page 387 for more tips on performing that calculation.
The program must have a method called IsPrime that takes an integer as an argument and returns true if the argument is a prime number and false otherwise
The input will come from a text file containing 10 or more random integer values with one value on each line
The output of the program will be a text file that for each line displays the input integer and whether or not it is prime
Each line of the output file will follow this format: [Input] - [IsPrime/NotPrime]
Here is a sample output file corresponding to this sample input file
(ouput file)
(input file)
The input file must be selected with an Open File Dialog
The output file must be selected with a Save File Dialog
Explanation / Answer
Problem 2 - Prime Numbers
using System;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.