Hi all, I am a newbie to C# and need help bad. I am to use looping (do,for, while or any combination).The program will accept a letter 'A' example and then end. What am i doing wrong.
Three salespeople work at Sunshine Hot Tubs-Andrea, Brittany, and Eric. Write a program that prompts the user for a salesperson’s initial (‘A’, ‘B’, or ‘E’). While the user does not type ‘Z’, continue by prompting for the amount of a sale the salesperson made. Calculate the salesperson’s commission as 10 percent of the sale amount, and add the commission to a running total for that salesperson. After the user types ‘Z’ for an initial, display each salesperson’s total commission earned. Save the file as TubSales.cs.
using System;
class Program
{
static void Main()
{
string inputString;//This grabs the user's response for the salespersons initial.
char response;
double saleAmount = new double();
double saleAmountA = new double();
double saleAmountB = new double();
double saleAmountE = new double();
double commissionA = (0.10 * saleAmountA);
double commissionB = (0.10 * saleAmountB);
double commissionE = (0.10 * saleAmountE);
Console.WriteLine("Please enter a salesperson's initial('A' for Andrea, 'B' for Brittany and 'E' for Eric and 'Z'to display each saleperson's total commmission earned)");
inputString = Console.ReadLine();
response = Convert.ToChar(inputString);
while(response == 'A')
{
Console.WriteLine("Please enter the sale amount that you made.");
inputString = Console.ReadLine();
saleAmount = Convert.ToDouble(inputString);
saleAmountA = commissionA += (0.10 * saleAmount);
while(response == 'B')
{
Console.WriteLine("Please enter the sale amount that you made.");
inputString = Console.ReadLine();
saleAmount = Convert.ToDouble(inputString);
saleAmountA = commissionA += (0.10 * saleAmount);
while(response == 'E')
{
Console.WriteLine("Please enter the sale amount that you made.");
inputString = Console.ReadLine();
saleAmount = Convert.ToDouble(inputString);
saleAmountA = commissionA += (0.10 * saleAmount);
while (response != 'Z')
Console.WriteLine("The total commission for each salesperson is: Andrea with {0},Brittany with {1}and Eric with {2}."
, saleAmountA.ToString("C"),saleAmountB.ToString("C"), saleAmountE.ToString("C"));
}
}
}
}
}