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"));
                }
            }
        }

   }
  }

Edited 5 Years Ago by __avd: Added [code] tags.

Too many while loops!
Use one loop on line 15: while (response != 'Z') and start arranging your code from there.

I have tried that, but i do not know where to put the 'do' or 'while' for the program to work.

Can you please show me how to fix the program to do what the question is asking.This is due tomorrow.

Hi, ronaldlazo, welcome :)
Please try to avoid resurrecting "old" threads. Read the rules of this site.
Coming to think of it, this thread probably made me post this snippet

This article has been dead for over six months. Start a new discussion instead.