Question: Write a C program that calculates and prints the average of two or more game points amounts entered by the user. The program should first
Write a C program that calculates and prints the average of two or more game points amounts entered by the user. The program should first prompt the user to enter the number of games to process (make sure at least 2 games is entered by use. If not, give an error message. Then prompt the user for each game points amount. As each game points amount is entered, the program should ensure that the each of the game points amount entered is greater or equal zero. If the amount is not at least zero, an error message should be displayed (as shown below), and the user should be re- prompted for a game points amount. Any bad game points entered should not be included in the average calculation. Once all values are entered, the program should calculate and print the average of all of the valid values entered. At the end display a message for the appropriate game points average. This program will feature the if statement as well as programming techniques for data validation. I call these trap loops. The loop traps the user into entering valid data. The dialog with the user will be as follows: Welcome to the points Analyzer. This program calculates the average of as many game points you wish to enter. First, enter the number of game points to process: Now enter the 4 game points to be processed. Enter game points amount #1: Enter game points amount #2: Enter game points amount # 3: *** Entry error! The game points amount must be positive. Enter game points amount #3: Enter game points amount #4: The Total points of the 4 games entered is The Average points of the 4 games points entered is Congratulations your team has done well.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
