Quiz3Notes.docx - While Loop HomeSales(Page 220#5 string initial = double Danielle = 0.00 double Edward = 0.00 double Francis = 0.00 double total = 0.00

Quiz3Notes.docx - While Loop HomeSales(Page 220#5 string...

This preview shows page 1 - 3 out of 3 pages.

While Loop HomeSales (Page 220 #5) string initial = "" ; double Danielle = 0.00; double Edward = 0.00; double Francis = 0.00; double total = 0.00; Console.WriteLine( "Welcome. The Holiday Homes sales people are: Danielle, Edward, & Francis." ); Console.ReadLine(); while (initial != "z" && initial != "Z" ) { Console.WriteLine( "Enter a salesperson's first initial: " ); initial = Console.ReadLine(); if (initial == "D" || initial == "E" || initial == "F" ) { Console.WriteLine( "Enter sales amount: " ); double salesAmount = Convert.ToDouble(Console.ReadLine()); if (initial == "D" ) Danielle += salesAmount; else if (initial == "E" ) Edward += salesAmount; else if (initial == "F" ) Francis += salesAmount; total = Danielle + Edward + Francis; } else Console.WriteLine( "ERROR. Please enter valid initial:" ); } Console.WriteLine( "Danielle's total amount is: {0}" , Danielle.ToString( "C" )); Console.ReadLine(); Console.WriteLine( "Edward's total amount is: {0}" , Edward.ToString( "C" )); Console.ReadLine(); Console.WriteLine( "Francis's total amount is: {0}" , Francis.ToString( "C" )); Console.ReadLine();
Image of page 1
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 3 pages?

  • Spring '10
  • NEWBY
  • Sales

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture