Reference no: EM13941282
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.
HINT:
Use an array to store the scores. Scan the array for the position of the largest and smallest values, then ignore these positions when computing the sum of the scores.
Consider the case where all judges give the diver the same score. In this case, the largest and smallest values will be the same. Make sure that your solution handles this case properly.
/**
* This program calculates the score for a contestant in diving.
* The highest and lowest scores are thrown out, the remaining are added
* together, and the sum multiplied by the degree of difficulty
* and 0.6.
* <P>
* This program uses an array to hold the seven scores, then
* scans the array for the position of the largest and smallest
* score. These positions are then ignored in computing the sum
* of the scores.
*/
import java.util.Scanner;
public class Diving {
public static void main(String[] args) {
double[] scores = new double[7];
int posMinScore, posMaxScore;
double sum = 0;
double difficulty;
double finalscore;
// --------------------------------
// ----- ENTER YOUR CODE HERE -----
// --------------------------------
// --------------------------------
// --------- END USER CODE --------
// --------------------------------
System.out.println("The diver's final score is " + finalscore);
}
}
If the company reduces variable expenses
: The variable expense per unit is $175 and fixed expenses are $100,000. If the company reduces variable expenses by $20 per unit and increases the fixed expenses by $10,000, the break-even point will DECREASE.
|
Explain all criminal behavior can be considered rational
: Analyze the impact that individual's environment and/or genetics have on the individual's ability to make a free choice not to commit criminal acts.
|
Behaviour of gas producers and gas consumers
: Critically assess the national gas access regime in Australia in terms of how it influences the behaviour of gas producers and gas consumers.
|
Target capital structure-what is the aftertax cost of debt
: Mullineaux Corporation has a target capital structure of 65 percent common stock, 5 percent preferred stock, and 30 percent debt. Its cost of equity is 11 percent, the cost of preferred stock is 5 percent, and the pretax cost of debt is 7 percent. Wh..
|
Program that inputs a degree of difficulty
: 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.
|
What do you know about natural medicines herbal cures
: What do you know about "natural" medicines, herbal cures and folklore or cultural practices to treat ailments? What practices do your family use
|
Consider the cash flows
: Consider the following cash flows: Year Cash Flow 0 –$ 34,000 1 15,100 2 16,600 3 12,500 Howell Petroleum, Inc., is trying to evaluate a generation project with the following cash flows: Year Cash Flow 0 –$37,500,000 1 56,500,000 2 –12,500,000
|
Estimates the cash flows used to analyze a proposed project
: Which of the following should be considered when a company estimates the cash flows used to analyze a proposed project?
|
How do one uses the macauleys model
: How do one uses the Macauleys model to find deflections of bars
|