Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

[PLEASE FOLLOW THE INSTRUCTIONS FOR EACH OF THE 4 FUNCTIONS INCLUDING MAIN]- You

ID: 644100 • Letter: #

Question

[PLEASE FOLLOW THE INSTRUCTIONS FOR EACH OF THE 4 FUNCTIONS INCLUDING MAIN]-

You have been asked to write C++ program that will help keep score for a gymnastics competition. There are seven judges who will report a score between 0 and 10 inclusively. You will need to calculate the average score after dropping the highest and lowest score. Your program will employ use 4 functions other than main.

First functions should be a void function that will accept two values, a score and a number of the judge, ask the user to enter the score for this judge, robustly confirm that the score is valid, then send the correct score back to main. This function will be called seven times from main (once for each judge).

Another function will determine the minimum score. This function will accept 7 score values, determine the minimum of the 7 values, and return the minimum value to the function call. This function should be called from the function to calculate the average.

Another function will determine the maximum score. This function will accept 7 score values, determine the maximum of the 7 values, and return the maximum value to the function call. This function should be called from the function to calculate the average.

Fourth function should calculate the average score for the gymnast. This function should accept 7 scores, call the function to determine the minimum score, call the function to determine the maximum score, calculate the average score without the minimum and maximum vales, and return the average. This function will be called from main.

The main function should prompt the user to enter the name of the gymnast (use a string object), call the appropriate functions and output the name of the gymnast and the average score for the gymnast.

*Do not use any system commands. & Please keep the code simple.

Thank you.

Sample output for entering and checking the scores and is shown below (your output will be different because it will include the gymnasts name).

[PLEASE FOLLOW THE INSTRUCTIONS FOR EACH OF THE 4 FUNCTIONS INCLUDING MAIN]- You have been asked to write C++ program that will help keep score for a gymnastics competition. There are seven judges who will report a score between 0 and 10 inclusively. You will need to calculate the average score after dropping the highest and lowest score. Your program will employ use 4 functions other than main. First functions should be a void function that will accept two values, a score and a number of the judge, ask the user to enter the score for this judge, robustly confirm that the score is valid, then send the correct score back to main. This function will be called seven times from main (once for each judge). Another function will determine the minimum score. This function will accept 7 score values, determine the minimum of the 7 values, and return the minimum value to the function call. This function should be called from the function to calculate the average. Another function will determine the maximum score. This function will accept 7 score values, determine the maximum of the 7 values, and return the maximum value to the function call. This function should be called from the function to calculate the average. Fourth function should calculate the average score for the gymnast. This function should accept 7 scores, call the function to determine the minimum score, call the function to determine the maximum score, calculate the average score without the minimum and maximum vales, and return the average. This function will be called from main. The main function should prompt the user to enter the name of the gymnast (use a string object), call the appropriate functions and output the name of the gymnast and the average score for the gymnast. *Do not use any system commands. & Please keep the code simple. Thank you. Sample output for entering and checking the scores and is shown below (your output will be different because it will include the gymnast½s name).

Explanation / Answer

#include <iostream>

using namespace std;

void getValue(double &score, int num){
   cout << "Enter the score from judge " << num << ". ";
   cin >> score;
   while(score > 10 || score < 0){
       cout << "A score cannot be be less than 0 or greater than 10!" << endl;
       cout << "Enter the score from judge: ";
       cin >> score;
   }
}

double min(double v1, double v2, double v3, double v4, double v5, double v6, double v7){
   if(v1 < v2 && v1 < v3 && v1 < v4 && v1 < v5 && v1 < v6 && v1 < v6){
       return v1;
   }
   else if(v2 < v1 && v2 < v3 && v2 < v4 && v2 < v5 && v2 < v6 && v2 < v6){
       return v2;
   }
   else if(v3 < v2 && v3 < v1 && v3 < v4 && v3 < v5 && v3 < v6 && v3 < v6){
       return v3;
   }
   else if(v4 < v2 && v4 < v3 && v4 < v1 && v4 < v5 && v4 < v6 && v4 < v6){
       return v4;
   }
   else if(v5 < v2 && v5 < v3 && v5 < v4 && v5 < v1 && v5 < v6 && v5 < v6){
       return v5;
   }
   else if(v6 < v2 && v6 < v3 && v6 < v4 && v6 < v5 && v6 < v1 && v6 < v6){
       return v6;
   }
   else if(v7 < v2 && v7 < v3 && v7 < v4 && v7 < v5 && v7 < v6 && v7 < v1){
       return v7;
   }
}

double max(double v1, double v2, double v3, double v4, double v5, double v6, double v7){
   if(v1 > v2 && v1 > v3 && v1 > v4 && v1 > v5 && v1 > v6 && v1 > v7){
       return v1;
   }
   else if(v2 > v1 && v2 > v3 && v2 > v4 && v2 > v5 && v2 > v6 && v2 > v7){
       return v2;
   }
   else if(v3 > v2 && v3 > v1 && v3 > v4 && v3 > v5 && v3 > v6 && v3 > v7){
       return v3;
   }
   else if(v4 > v2 && v4 > v3 && v4 > v1 && v4 > v5 && v4 > v6 && v4 > v7){
       return v4;
   }
   else if(v5 > v2 && v5 > v3 && v5 > v4 && v5 > v1 && v5 > v6 && v5 > v7){
       return v5;
   }
   else if(v6 > v2 && v6 > v3 && v6 > v4 && v6 > v5 && v6 > v1 && v6 > v7){
       return v6;
   }
   else if(v7 > v2 && v7 > v3 && v7 > v4 && v7 > v5 && v7 > v6 && v7 > v1){
       return v7;
   }
}

double average(double v1, double v2, double v3, double v4, double v5, double v6, double v7){
   return (v1 + v2 + v3 + v4 + v5 + v6 + v7 - min(v1, v2, v3, v4, v5, v6, v7) - max(v1, v2, v3, v4, v5, v6, v7)) / 5;
}

int main(){
   double v1, v2, v3, v4, v5, v6, v7;
   string name;
   cout << "Enter name of the gymnast: ";
   cin >> name;
   getValue(v1, 1);
   getValue(v2, 2);
   getValue(v3, 3);
   getValue(v4, 4);
   getValue(v5, 5);
   getValue(v6, 6);
   getValue(v7, 7);
   cout << "The average score for " << name << " was " << average(v1, v2, v3, v4, v5, v6, v7) << endl;
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote