Question: Needs to be completed in C++ A particular talent competition has five judges, each of whom awards a score between 0 and 10 to each

Needs to be completed in C++

A particular talent competition has five judges, each of whom awards a score between 0 and 10 to each performer. Fractional scores, such as 8.3, are allowed. A performer's final score is determined by dropping the highest and lowest score received, then averaging the remaining scores. Write a program that uses this method to calculate a contestant score. It should include the follwowing functipons. void getJudgeData() should ask the user for a judge's, store it in a reference parameter variable, and validate it. This function should be called by main for each of the five judges. void calcScore() should calculate and display the average of the average of the three scores that remain after dropping the highest and the lowest score a performer received. This function should be called just once by main, and should be passed the five scores. The last two functions, described below, should be called by calcScore, which uses the returned information to determine which of the scores to drop. int findLowest() should find and return the lowest of the five scores passed to it. int findHighest() should find and return the highest of the five scores passed to it. Input Validation: Do not accept test scores lower than 0 or higher than 10.

What I have so far:

#include

using namespace std;

//Function Prototypes.

void getJudgeData(double &); //Store in reference variables.

void calcScore(double, double, double, double, double);

double findLowest();

double findHighest();

double lowNum; //global variable.

double highNum; //global variable.

int main()

{ double score1 = 0.0, score2 = 0.0, score3 = 0.0, score4 = 0.0, score5 = 0.0; //double avgScore; cout << "Enter each Judge's score. ";

cout << "Enter Judge #1 score: "; getJudgeData(score1); //Input Validation. if (score1 < 0 || score1 > 10) { cout << score1 << " is invalid. "; cout << "Enter a score between 0 and 10. "; cin >> score1; } cout << "Enter Judge #2 score: "; getJudgeData(score2);

//Input Validation. if (score2 < 0 || score2 > 10) { cout << score2 << " is invalid. "; cout << "Enter a score between 0 and 10. "; cin >> score2; } cout << "Enter Judge #3 score: "; getJudgeData(score3); //Input Validation. if (score3 < 0 || score3 > 10) { cout << score3 << " is invalid. "; cout << "Enter a score between 0 and 10. "; cin >> score3; } cout << "Enter Judge #4 score: "; getJudgeData(score4); //Input Validation. if (score4 < 0 || score4 > 10) { cout << score4 << " is invalid. "; cout << "Enter a score between 0 and 10. "; cin >> score4; } cout << "Enter Judge #5 score: "; getJudgeData(score5); //Input Validation. if (score5 < 0 || score5 > 10) { cout << score5 << " is invalid. "; cout << "Enter a score between 0 and 10. "; cin >> score5; } //Call the calcScore function, void calcScore(void); //Pause the system to display the results. system("Pause"); return 0; }

//Definition of the getJudgeData function. void getJudgeData(double &getNum) { cin >> getNum; return; }

//Definition of the calcScore function. void calcScore(double score1, double score2, double score3, double score4, double score5) { findLowest(); //call function findLowest. findHighest(); //call function findHighest. //Add the 3 remaining scores, and divide by 3 //to get the average score and display it. double avgScore, num1=0, num2=0, num3=0; avgScore = (num1 + num2 + num3) / 3; }

//Definition of the findLowest function. double findLowest() { return lowNum; }

//Definition of the findHighest function. double findHighest() { return highNum; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!