Question

In: Computer Science

In the sport of diving, seven judges award a score between 0 and 10, where each...

In the sport of diving, seven judges award a score between 0 and 10, where each score may be a floating-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 drive. 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 program that inputs a degree of difficulty and then input seven judges’ scores using a loop and outputs the overall score for that dive.

You are required to check whether a judge’s score is indeed between 0 and 10. You also have to check whether the difficulty is between 1.2 and 3.8. When the user enters a number that is not in the range, ask the user to enter it again.

Example: To ask the user to enter a score between 0 and 100

               do{

                    cout<<”Enter a number between 0 and 100”;

                   cin>>score;

              }while(score<0 || score>100);

Hint: You should use a loop to find total score, highest score, and lowest score. You then subtract total from highest and lowest. Multiply result by difficulty and 0.6 to get the final score. If the user enters difficulty as 2 and seven judges give score as 1, 2, 3, 4, 5, 6, and 7. Then the final score should be 24

                             

do it in C++

Solutions

Expert Solution


#include <iostream>
using namespace std;

int main(){
        
        float scores[7];
        float difficulty;
        
        cout << "Enter 7 Judge scores" <<endl;
        // read 7 judge scores in range 0 and 10
        for(int i=0; i<7 ;i++){
                while(true){
                        cout <<"Enter Judge "<< (i+1)<<" scores between 0 to 10 : ";
                        cin >> scores[i];
                        if( scores[i] >= 0 && scores[i] <= 10 ){
                                break;
                        }
                        cout << "Enter valid score" << endl;
                }
        }
        // read difficulty scores in range 1. and 3.8
        while(true){
                cout << "Enter degree of difficulty : ";
                cin >> difficulty;
                if( difficulty >= 1.2 && difficulty <=3.8 ){
                        break;
                }
        }
        
        float minScore = scores[0];
        float maxScore = scores[0];
        float total = 0;
        // finding lowest, highest and total scores
        for(int i=0; i<7 ;i++){
                total += scores[i];
                if( minScore > scores[i] ){
                        minScore = scores[i];
                }
                if( maxScore < scores[i] ){
                        maxScore = scores[i];
                }
        }
        
        float temp = total - (minScore + maxScore);
        // calculating final score
        float finalScore = temp * difficulty * 0.6;
        cout << "Final Score : " << finalScore;
        return 1;
}

Code

Output


Related Solutions

Instructions A particular talent competition has five judges, each of whom awards a score between 0...
Instructions A particular talent competition has five judges, each of whom awards a score between 0 and 10 to each performer. Fractional scores, such as 8.3, are allowed. A performer’s final score is determined by dropping the highest and lowest score received, then averaging the three remaining scores. Write a program in Python that uses this method to calculate a contestant’s score. It should include the following functions: getJudgeData( ) should ask the user for a judge’s score, and validate...
The score of a student on a certain exam is represented by a number between 0...
The score of a student on a certain exam is represented by a number between 0 and 1. Suppose that the student passes the exam if this number is at least 0.55. Suppose we model this experiment by a continuous random variable X, the score, whose probability density function is given by f(x) = { x if 0 <= x < 0.5 5x - 2 if 0.5 <= x <= 1 0 otherwise } a. What is the probability that...
Two critics rate the service at six award-winning restaurants on a continuous 0 to 10 scale....
Two critics rate the service at six award-winning restaurants on a continuous 0 to 10 scale. Their rankings are shown in the table below. Restaurant 1 2 3 4 5 6 Critic 1: 6.1 5.2 8.9 7.4 4.3 9.7 Critic 2: 7.3 5.5 9.1 7.0 5.1 9.8 a) Is this paired or unpaired data? b) Compute a 95% confidence interval for the mean difference in rating. Show all your working. c) Is there a difference between the critics’ ratings, allowing...
Find each of the probabilities where z is a z-score from a standard normal distribution with...
Find each of the probabilities where z is a z-score from a standard normal distribution with a mean of μ=0 and standard deviation σ=1. Make sure you draw a picture of each problem.   Show all steps with TI 83 P(z < 2.15) P(z > 0.71) P(-1.45 <z < 2.17)
Use MATLAB to create a vector x having six values between 0 and 10 (including the endpoints 0 and 10
Use MATLAB to create a vector x having six values between 0 and 10 (including the endpoints 0 and 10). Create an array A whose rst row contains the values 3x and whose second row contains the values 5x - 20.  
Is there a correlation between the two bowlers themselves? In other words – does Aron’s score in each game depend on Mjorgan’s score at all?
Aron 1 2 3 4 Average 8/6/2017 90 138 118 105 112.8 8/19/2017 162 101 120 145 132 9/16/2017 101 129 132 111 118.3 Average 117.7 122.7 123.3 120.3 121 Mjorgan 1 2 3 4 Average 8/6/2017 115 88 94 102 99.8 8/19/2017 89 75 77 90 82.8 9/16/2017 74 110 117 90 97.8 Average 92.7 91 96 94 93.4 Is there a correlation between the two bowlers themselves? In other words – does Aron’s score in each game depend...
Consider a firm facing a downward-sloping demand curve for its product given by: ?(?)=10−? where 0≤?≤10...
Consider a firm facing a downward-sloping demand curve for its product given by: ?(?)=10−? where 0≤?≤10 denotes the price of the firm’s output. The firm produces its output under a constant marginal cost of ?=1. a) Write down the firm’s profit-maximization problem assuming the firm’s choice variable is quantity. Find the firm’s profit-maximizing price and quantity. b) Based on your answers to part (a), find the firm’s equilibrium profits. sketch the firm’s demand, marginal revenue, and marginal cost functions.
1. Find the area under the standard normal distribution for each z score. a. Between 1.56...
1. Find the area under the standard normal distribution for each z score. a. Between 1.56 and 1.96 b. To the right of 1.75 c. To the left of 1.36 2. The average amount of rain per year in Greenville is 49 inches. The standard deviation is 7.5 inches. Find the probability that next year Greenville will receive the following amount of rainfall. Assume the variable is normally distributed. a. At most 55 inches of rain b. At least 62...
8) What proportion of a normal distribution is located between each of the following z-score boundaries?...
8) What proportion of a normal distribution is located between each of the following z-score boundaries? a. z = –0.25 and z = +0.25 b. z = –0.67 and z = +0.67 c. z = –1.20 and z = +1.20 13) A normal distribution has a mean of μ = 30 and a standard deviation of σ = 12. For each of the following scores, indicate whether the body is to the right or left of the score and find...
Perform a goodness-of-fits test to determine if a uniform distribution between 0 and 10 is a...
Perform a goodness-of-fits test to determine if a uniform distribution between 0 and 10 is a good fit to the 150 data observations summarized in the table below. Use α=0.05. Range of data values 0.0 < X < 2.0 2.0 < X < 4.0 4.0 < X < 6.0 6.0 < X < 8.0 8.0 < X < 10.0 Number of observations in this range 28 35 29 31 27
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT