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

A particular talent show has five judges, each of who awards a score between 0 a

ID: 3640820 • Letter: A

Question

A particular talent show has five judges, each of who awards a score between 0 and 10 to each performer. Fractional scores like 8.3 are allowed. The final score is determined by dropping the highest and lowest scores, then averaging the three remaining scores. Write a program that uses this method to calculate a contestants score. It should include the following functions:

void getJudgeData()should ask the user for a judges score,store it in a reference parameter variable, and validate it. This function should be called by main once for each of the five judges.

void calcScore() should calculate and display the average of the three scores that remain after dropping the highest and lowest scores. This function should be called just once by main, and should be passed the five scores.

The last two functions 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 score passed to it
int findHighest() should find and return the highest score passed to it

Input Validation: do not accept scores lower than 0 or higher than 10

Explanation / Answer

please rate - thanks

#include <iostream>
using namespace std;
void getJudgeData(double&);
void calcScore(double[]);
double findLowest(double[]);
double findHighest(double[]);
int main()
{ double scores[5];
int i;
for(i=0;i<5;i++)
    getJudgeData(scores[i]);
calcScore(scores);

system("pause");
return 0;
}
void getJudgeData(double& s)
{cout<<"Enter score between 0 and 10: ";
cin>>s;
while(s<0||s>10)
    {cout<<"score must be between 0 and10 ";
     cout<<"Enter score between 0 and 10:";
     cin>>s;
     }
}
void calcScore(double s[])
{double low,high,tot=0,avg;
int i;
low=findLowest(s);
high=findHighest(s);
for(i=0;i<5;i++)
    tot+=s[i];
avg=(tot-low-high)/3.;
cout<<"This contestant's talent score is:"<<avg<<endl;
}
double findLowest(double s[])
{int i;
double n;
n=s[0];
for(i=1;i<5;i++)
     if(s[i]<n)
         n=s[i];
return n;
}

double findHighest(double s[])
{int i;
double n;
n=s[0];
for(i=1;i<5;i++)
     if(s[i]>n)
         n=s[i];
return n;
}

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