a program that computes a diver’s score based on the degree of difficulty and 5 judge’s scores. In diving, the low and the high score are dropped. The middle three scores are added and then multiplied by the degree of difficulty. Unfortunately, this program doesn’t work. There are three logical errors in it.

Correct Output (Inputs in Bold)

Please enter the degree of difficulty: 2.3

Please enter the score from Judge #1: 6.0

Please enter the score from Judge #2: 5.5

Please enter the score from Judge #3: 6.5

Please enter the score from Judge #4: 7.0

Please enter the score from Judge #5: 6.0

The score for the dive is: 42.55

*****************************************************************************

#include <iostream>

#include <string>

#include <iomanip>

using namespace std;

/* This program computes the score for a dive based on the
degree of difficulty

* and five judges scores. The high and low scores are
dropped.

*/

/* Function prototypes */

void inputScores(double scores[]);

double addAllScores(double scores[]);

double findLowScore(double scores[]);

double findHighScore(double scores[]);

int main()

{

double difficulty, sum, lowScore, highScore,
score;

double judgeScores[5];

cout << "Please enter the degree of
difficulty: ";

cin >> difficulty;

inputScores(judgeScores);

sum = addAllScores(judgeScores);

lowScore = findLowScore(judgeScores);

highScore = findHighScore(judgeScores);

/* subtract out the low and high scores */

sum = sum - lowScore - highScore;

/* multiply by degree of difficulty */

score = sum * difficulty;

cout << "The score for the dive is: "
<< fixed << setprecision(2) << score <<
endl;

system("pause");

}

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

// This function gets the judges scores

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

void inputScores(double scores[])

{

for (int i = 0; i < 5; i++)

{

cout << "Please enter the
score from Judge #" << i + 1 << ": ";

cin >> scores[i];

}

}

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

//This function determines the sum of the scores input.

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

double addAllScores(double scores[])

{

double total;

// Add up all of the scores

for (int count = 0; count < 5; count++)

{

total += scores[];

}

return total;

}

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

//This function determines the lowest score input.

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

double findLowScore(double scores[])

{

double lowest = 99999.0;

//determine lowest score

for (int count = 0; count <= 5; count++)

{

if (lowest >
scores[count])

lowest =
scores[count];

}

return lowest;

}

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

//This function determines the highest score input.

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

double findHighScore(double scores[])

{

double highest = -1;

//determine highest score.

for (int count = 0; count < 5; count++)

{

if (highest <
scores[count])

highest =
scores[count];

}

return highest;

}

Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.

Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.

Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.Find step-by-step answers from expert tutors to questions asked by students like you. Start 14-day free trial.