Ask your own question, for FREE!
Computer Science 21 Online
OpenStudy (anonymous):

Can anyone help me to solve this problem in C++? A particular talent competition has 5 judges,each of whom awards a score between 0 & 10 to each performer. A performer's final score is determined by dropping the highest and lowest score received, then averaging the three remaining scores.The program should include the following functions:1) void getJudgeData() to ask the user for a judge's score, store it in a reference parameter variable, &validate it. (cont)

OpenStudy (anonymous):

(cont) 2) void calcScore ( ) should calculate and display the average of the three scores that remain after dropping the highest and lowest scores the 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 judge scores lower than 0 or higher than 10.

OpenStudy (anonymous):

This is what I got so far. I couldn't compile it and i dont know how to find the highest and lowest values. please help #include <iostream> using namespace std; void getJudgeData(double&); void calcScore(double, double, double, double, double); double findLowest(double, double, double, double, double); double findHighest(double, double, double, double, double); int main(){ double scoreS1, scoreS2, scoreS3, scoreS4, scoreS5; getJudgeData(scoreS1); getJudgeData(scoreS2); getJudgeData(scoreS3); getJudgeData(scoreS4); getJudgeData(scoreS5); calcScore(scoreS1, scoreS2, scoreS3, scoreS4, scoreS5); double value1, value2, value3; return 0; } void getJudgeData(double &scores1) { cin >> scores1; cout << "Enter the score between 0 and 10 of a contastant"; cin >> scores1; while (scores1 < 0 || scores1 > 10) { cout << "The Scores cannot be less than zero or higher than 10" << endl; cout << "Enter the score again" << endl; cin >> scores1; } } void calcScore(double score1, double score2, double score3, double score4, double score5) { double result; result = ( score1 + score2 + score3 + score4 + score5 - findLowest(score1, score2, score3, score4, score5) - findHighest( score1, score2, score3, score4, score5) ) / 3; cout << "The contastant's average score is "<< result <<endl; } double findLowest(double scoreS11, double scoreS21, double scoreS31, double scoreS41, double scoreS51) { double lowest lowest = return lowest } double findHighest(double scoreS12, double scoreS22, double scoreS32, double scoreS42, double scoreS52) { double highest; highest = return highest; }

OpenStudy (anonymous):

I couldn't compile this program and I dont know how to find the highest and lowest scores....please help....

OpenStudy (rsmith6559):

I don't want to insult you, but that code is a mess. Set it aside, some of it can be copied into a new source file. You need to break things down more, and handle each one, one at a time. Start a new source file. Put in your headers, namespace and an empty main(). Put in the required functions as empty functions. Put in comments describing what you're going to do in each of these functions. As you're commenting, think about how you're going to do what your comments say you will. You may want/need other functions to accomplish what these top level functions are supposed to do. Now write the code for A function. You can use your empty main() to test your function. Once this function works right, on to the next. After all the functions work, then write main() to use the functions to accomplish what you want. One lecture that I watched suggested that if a function has more than about 15 lines of code, you probably haven't broken things down enough, you're biting off too much at one time.

OpenStudy (anonymous):

ok then can you tell me how to find the highest and lowest from the five scores?

OpenStudy (rsmith6559):

You could put the numbers into an array and sort them. You could just iterate through them comparing them. You could iterate through them calling math.min() or math.max() on each "winner" and new value.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!