Hi everyone,
I am new to C# and also new to programming and I'm having a blonde moment. I have been working on this project for a week but have not figured out how to work this one out. I would appreciate any help you can provide.
1. Output total number of salary ranges:
200 - 299, 300-399, 400-499, 500-599, 600-699, 700-799, 800-899,
1000+
2. Input gross sales.
3. If quit (-1) go to step 8
4. Calculate the salary =$200 + 9% * gross sales (entered by user)
5. Determine the salary range that the calculated salary falls into.
6. Increment a counter for the salary range determined.
7. Repeat steps 2 thru 6.
8. Display a summary of the number of salaries falling into the salary ranges
as indicated.
9. Exit the program.
static void Main(string[] args)
{
int sales;
do
{
Console.Write("Enter in the sales for the salesperson (-1 to quit): ");
sales = int.Parse(Console.ReadLine());
} while (sales != -1);
{
int[] salesArray = new int[sales];
for (int counter = 0; counter < sales; counter++)
sales = 200 + ((9 / 10) * sales);
//store sales in each salary range
int[] frequency = new int[9];
//for each sales frequency increment appropriate counter
foreach (int sales in salesArray)
++frequency[sales / 100];
//for each sales, print number
for (int count = 0; count < frequency.Length; count++)
{
if (count == 100)
Console.Write("1000 and over: ");
else
Console.Write("{0:D2}{1:D2}: ", count * 100, count * 100 + 9);
}
Console.WriteLine("{0,20}{1,30}", "Salary Range", "Number of Salespeople");
}
}
}
}