Part 1: Code a solution from the problem statement Gymnastics Competition A Gymnastics competition uses one of two methods for calculating the gymnast’s score. The competition utilizes 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. Be creative. Name your competition. Make the message user-friendly and display it in a pleasing manner. 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 contestant’s full 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 contestant’s final score is determined by calculating an average of the three scores. Use a constant string for the error message. Display the contestant’s 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 contestant’s full 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 contestant’s 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. You determine three different messages to give the gymnast based on their score in three categories. If the average score is between zero and 5.0, display message 1. Use a string constant for message 1. If the average score is greater than 5.0 and less than 8.0, display message 2. Use a string constant for message 2. If the average score is greater than or equal to 8.0, display message 3. Use a string constant for message 3. Display the contestant’s full name, average score, and message in a user-friendly format. End the program when the user chooses the Quit option from the menu. Note: Only use the skills learned so far in the class. No arrays. No functions. No structs. Save your file as LastName_FirstName_Midterm.cpp and submit to Canvas. Part 2: Submit a walk-through of your code.
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Part 1: Code a solution from the problem statement
Gymnastics Competition
A Gymnastics competition uses one of two methods for calculating the gymnast’s score. The competition utilizes 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
- Display a welcome message to the user. Be creative. Name your competition. Make the message user-friendly and display it in a pleasing manner.
- 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 contestant’s full 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 contestant’s final score is determined by calculating an average of the three scores. Use a constant string for the error message. Display the contestant’s 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 contestant’s full 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 contestant’s 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.
- You determine three different messages to give the gymnast based on their score in three categories.
- If the average score is between zero and 5.0, display message 1. Use a string constant for message 1.
- If the average score is greater than 5.0 and less than 8.0, display message 2. Use a string constant for message 2.
- If the average score is greater than or equal to 8.0, display message 3. Use a string constant for message 3.
- Display the contestant’s full name, average score, and message in a user-friendly format.
- You determine three different messages to give the gymnast based on their score in three categories.
- End the program when the user chooses the Quit option from the menu.
Note: Only use the skills learned so far in the class. No arrays. No functions. No structs.
Save your file as LastName_FirstName_Midterm.cpp and submit to Canvas.
Part 2: Submit a walk-through of your code.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 6 images