Question: #include judge _ functions.h #include / / Calculate and return the Olympics average of scores. / / The return value is the average mean
#include "judgefunctions.h
#include
Calculate and return the Olympics average of scores.
The return value is the average mean of all elements of scores, except for
the minimum and maximum elements.
double JudgeAveragestd::vector& scores
TODO: Declare a variable named scoresum of type double and
initialize it to
TODO: Using a for loop, iterate through the scores variable and
sum up all the values and store it in the variable scoresum.
TODO: Declare a variable named minimumscore of type double. Initialize
minimumscore to the first value in in the scores vector using the
front member function.
TODO: Using a for loop, find the minimum value in scores and
assign it to minimumscore.
TODO: Declare a variable named maximumscore of type double. Initialize
maximumscore to the first value in in the scores vector using the
front member function.
TODO: Using a for loop, find the maximum value in scores and
assign it to maximumscore.
TODO: Declare a variable named adjustedsum of type double. Initialize
adjustedsum by eliminating the minimum and maximum scores from scoresum.
This can be done by subtracting minimumscore and maximumscore from
scoresum.
TODO: Compute the denominator; declare a variable named denominator
of type double. Initialize this variable to the number of elements in
score minus We are finding the average score and excluding the two
lowest scores so we will divide by the size of scores
Remember that we're dividing so we want the variable denominator to be
a double.
TODO: Declare a variable named average of type double, intialize it
with the quotient of adjustedsum divided by denominator.
TODO: return the variable average. Replace the with the variable
average.
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
