Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// 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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Draw a labelled diagram of the Dicot stem.

Answered: 1 week ago