Gymnastics Competition

Gymnastics Competition

A Gymnastics competition uses one of two methods for calculating the gymnasts score. The competition utilized either three judges or five judges. Write a program to ask which scoring method is utilized and how many competitors are in the competition. Then input the scores from the judges, and calculate the average score for a contestant. Use the following algorithm as a guide.

Algorithm

Display a welcome message to the user.

Display a menu to the user with options for three judges, five judges or quit. If a user enters an option that is not on the menu, display a user-friendly error message and allow the user to try again. Use a string constant for the error message.

If the competition utilizes three judges, ask how many gymnasts are in the competition. Validate that the number is between 1 and 20. For each gymnast, ask the user to input the contestants name and the three scores. A score must be between 0 and 10 and fractional scores such as 6.5 are allowed. If a user inputs an invalid score, present a user-friendly error message and allow the user to try again.  A contestants final score is determined by calculating an average of the three scores. Use a constant string for the error message. Display the contestants name and average score in a user-friendly format.

If there are five judges, ask how many gymnasts are in the competition. Validate that the number is between 1 and 50. For each gymnast, ask the user to input the contestants name and input the five scores. A score must be between 0 and 10 and fractional scores such as 6.5 are allowed. . If a user inputs an invalid number, present a user-friendly error message and allow the user to try again. A contestants final score is determined by dropping the highest score and lowest score, then averaging the three remaining scores. Use a constant string for the error message. Display the contestants name and average score in a user-friendly format.

Ask the user if she wishes to run the program again. Depending on the answer, show the menu again or end the program.

DO NOT USE ARRAYS/FUNCTIONS

You can leave a response, or trackback from your own site.