between 0 and 1 inclusive LOW HIGH Increment loop control variable Write Enter

Between 0 and 1 inclusive low high increment loop

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

"between {0} and {1} inclusive" , LOW, HIGH); //Increment loop control variable Write( "Enter an ID number: " ); input = ReadLine(); idNum = Convert .ToInt32(input); } //Print Results WriteLine( "ID number {0} is valid" , idNum); //Pause ReadLine(); } } } Write and run the program your side of the class was given. – 1 st Assignment What are your variables and constants? const double QUIT = -999987; double sales=0, count = 0, total = 0, avg; What needs to be repeated? total = total +sales; count = count +1; Console .WriteLine( "What is the sales total?" ); sales = Convert .ToDouble( Console .ReadLine()); How do you stop repeating? Enter QUIT value, ‘-999987’ CODE:
Image of page 2
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; /* Project Name: Sales World * Created on: 3/14/2017 * Created by: Guillermo Arreola Hernandez */ namespace SalesWorld { class Program { static void Main( string [] args) { //Declare Constant and Variables const double QUIT = -999987; double sales=0, count = 0, total = 0, avg; Console .WriteLine( "What is the sales total?" ); sales = Convert .ToDouble( Console .ReadLine()); while (sales != QUIT) { //Calculate total and count total = total +sales; count = count +1; //increment loop control variable Console .WriteLine( "What is the sales total?" ); sales = Convert .ToDouble( Console .ReadLine()); } //Calculate Avg avg = total / count; //Display Results Console .WriteLine(); Console .WriteLine( " ................................. " ); Console .WriteLine(); Console .WriteLine( "RESULTS" ); Console .WriteLine( "" ); Console .WriteLine( "Total Sales: {0}" , count); Console .WriteLine( "Total Amount: {0}" , total.ToString( "C2" )); Console .WriteLine( "Average Sales Amount: {0}" , avg.ToString( "C2" )); Console .ReadLine(); } } }
Image of page 3

You've reached the end of your free preview.

Want to read all 3 pages?

  • Spring '10
  • NEWBY

  • 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