62.7k views
0 votes
Write, compile, and test a program called AveragingNumbers that adds a series of up to 10 numbers (numbers can be either an integer or a double) and calculates the average. If the user enters 999 (Sentinel value) the program quits/terminates and displays every number that was entered and also an average of the numbers

User Kgthegreat
by
8.1k points

1 Answer

2 votes

Final answer:

The AveragingNumbers program requires knowledge of loops, conditional statements, and user interaction via input/output to calculate the average of up to 10 numbers, terminating when the sentinel value '999' is entered.

Step-by-step explanation:

The student's question pertains to the creation of a simple program that calculates the average of a series of numbers that are entered by the user. The program, dubbed AveragingNumbers, should also handle a special case where if the user enters the sentinel value '999', the program will terminate, display all numbers provided by the user thus far, and calculate the average of those numbers. In this scenario, programming concepts such as loops, conditionals, and arrays or lists will be used, as well as input/output operations to interact with the user. The key to solving this problem lies in understanding the flow of input from the user, determining when to terminate input gathering, and performing the calculations to obtain the average.

User Frank Cannon
by
8.1k points