Hello everyone! This is my first post on the site! I was hoping the community here could help me out with an assignment I had in class.
In the sport of diving, seven judges award a score between 0 and 10, where each score may be a floating-point value. The highest and lowest scores are thrown out and the remaining scores are added together. The sum is then multiplied by the degree of difficulty for that dive. The degree of difficulty ranges from 1.2 to 3.8 points. The total is then multiplied by 0.6 to determine the diver’s score.
Write a computer program that inputs a degree of difficulty and seven judges’ scores, and outputs the overall score for that dive. The program should ensure that all inputs are within the allowable data ranges. To make your programming easier, if a number is out of range (greater than the upper limit or less than the lower limit), then let the program replace it with upper or lower limit numbers.
Hint: Use double Array and for loop statement to store each Judge’s score
Hint: Use highest variable with the initial value of 0, and lowest variable with the initial value of 10, in order to find out the highest and the lowest scores .
*** sample output
Please enter the difficulty level(1.2 - 3.8): 1
Enter the score of judge 1: 5
Enter the score of judge 2: 4
Enter the score of judge 3: 3
Enter the score of judge 4: 2
Enter the score of judge 5: 1
Enter the score of judge 6: 6
Enter the score of judge 7: 7
Scores = { 5 4 3 2 1 6 7 }
Difficulty level = 1.2
Total score = 14.4
This is what I have so far. I'm a complete beginner so please have mercy!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#include <iostream>
using namespace std;
double highest = 0;
double lowest = 10;
double difficulty = 0;
float score [6];
int main ()
{
cout << "please enter the difficulty level(1.2 - 3.8):" << endl;
cin >> difficulty;
cout << "Enter the score of judge 1: " << endl;
cin >> score[6];
for (score = 0; score < 6; score++)
cout << "Did this work?" << endl;
system("pause");
return 0;
|