Question: // PLEASE CODE THE FOLLOWING in C: call getMinMax in calculateScore(LIST *perfData). Thank you. /* ******************************************************* Determines the lowest and highest score for one performer

// PLEASE CODE THE FOLLOWING in C: call getMinMax in calculateScore(LIST *perfData). Thank you.

/* *******************************************************

Determines the lowest and highest score for one performer

PRE : scoresList[] - a list of 5 scores

POST : lowest, highest scores determined

and passed back to the caller as output parameters

*/

void getMinMax(const int scoreList[], int *min, int *max)

{

int j;

*min = *max = scoreList[0];

for (j = 1; j < NUM_JUDGES; j++)

{

if (scoreList[j] < *min)

*min = scoreList[j];

if (scoreList[j] > *max)

*max = scoreList[j];

}

}

/* *******************************************************

Calculates the final score for each performer:

average of 3 scores with lowest and highest eliminated

PRE : perfData - without the final score

POST : perfData - with the final score calculated

*/

void calculateScore(LIST *perfData)

{

int i, j;

int finalScore, lowest, highest;

for (i = 0; i < perfData->size; i++)

{

finalScore = 0;

for (j = 0; j < NUM_JUDGES; j++)

{

finalScore += perfData->list[i].scores[j];

}

// call getMinMax

perfData->list[i].final = finalScore - lowest - highest;

}

}

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!