Question: #include judge _ functions.h #include / / Calculate and return the Olympics average of scores. / / The return value is the average mean

#include "judge_functions.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 JudgeAverage(std::vector& scores){
// TODO: Declare a variable named score_sum of type double and
// initialize it to 0.0.
// TODO: Using a for loop, iterate through the scores variable and
// sum up all the values and store it in the variable score_sum.
// TODO: Declare a variable named minimum_score of type double. Initialize
// minimum_score 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 minimum_score.
// TODO: Declare a variable named maximum_score of type double. Initialize
// maximum_score 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 maximum_score.
// TODO: Declare a variable named adjusted_sum of type double. Initialize
// adjusted_sum by eliminating the minimum and maximum scores from score_sum.
// This can be done by subtracting minimum_score and maximum_score from
// score_sum.
// TODO: Compute the denominator; declare a variable named denominator
// of type double. Initialize this variable to the number of elements in
// score minus 2.(We are finding the average score and excluding the two
// lowest scores so we will divide by the size of scores -2.)
// 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 adjusted_sum divided by denominator.
// TODO: return the variable average. (Replace the 0.0 with the variable
// average.)
return 0.0;
}

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 Programming Questions!