Assignment 3.docx - Assignment 3 \u2013 Loops Arrays 1 Multiple Choice Chapter 5 Pages 217 \u2013 219(odd 1 D 3 C 5 A 7 B 9 A 11 C 13 B 15 D 17 B 19 C 2

Assignment 3.docx - Assignment 3 u2013 Loops Arrays 1...

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

Assignment 3 – Loops & Arrays 1. Multiple Choice Chapter 5: Pages 217 – 219 (odd) 1. D. 3. C. 5. A. 7. B. 9. A. 11. C. 13. B. 15. D. 17. B. 19. C. 2. Program problems: a. While Loop SumInts (Page 220 #2) static void Main(string[] args) { int Num=0; int Sum=0; while (Num != 999) { Console.WriteLine("Please enter a number:"); Num = Convert.ToInt32(Console.ReadLine()); if (Num != 999) { Sum = Sum + Num; } } Console.WriteLine("The sum of all the numbers is {0}", Sum); Console.ReadLine(); } b. 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();
Image of page 1
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(
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
  • 2005 albums

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes