Program that inputs a degree of difficulty

Assignment Help JAVA Programming
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);
}
}

Reference no: EM13941282

Questions Cloud

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

Reviews

Write a Review

JAVA Programming Questions & Answers

  Modify the scholarship application

Modify the Scholarship application so that if a user enters a grade point average under 0 or over 4.0, or a negative value for either of the activities, an error message appears.

  Create a class named blooddata that includes fields

Create a class named BloodData that includes fields that hold a blood type (the four blood types are O, A, B, and AB) and an Rh factor (the factors are + and -). Create a default constructor that sets the fields to "O" and "+", and an overloaded c..

  Explain a gui interface using advanced java swing classes

Implement a threads and a GUI interface using advanced Java Swing classes. The project will be graded according the criteria for the final project

  Method that reads a text file and returns a list of tokens

Write a method that reads in a text file and returns a list of the tokens (preferably alphanumeric) in that file. Write a method to print out frequency results.

  Process of buying a soda from a soda machine

Please write a Java Program those steps through the process of buying a soda from a Soda Machine.  You must interact with the consumer. Each Soda is one dollar.

  A java program where the user designates

a java program where the user designates how many games they would like to play (for example user inputs 10 games) then they play the game, if lets say there is a tie after 10 games the game continues until either the user of the computer wins by 2

  Improve the word jumble game

Improve the Word Jumble game presented in this chapter so that each word is paired with a hint. If the player enters hint, then the program should show the corresponding hint.

  You must also do the work of sorting

You must also do the work of sorting in the method. You cannot just call another library method. Use loops to show the data in the original array as well as the repopulated array in ascending order.

  Modify the inventory program by adding a button to the gui

If the first item is displayed and the user clicks on the Previous button, the last item should display. If the last item is displayed and the user clicks on the Next button, the first item should display. Add a company logo to the GUI using Java ..

  Write a java application that allows the user to read

Write a java application that allows the user to read, validate, store, display, sort and search the internet account number (integer number), usage (integer number) and cost (double number) for N customers. N should be declared as a constant and it ..

  Driveway is a "last-in, first-out" stack. of course

Driveway is a "last-in, first-out" stack. Of course, when a car owner retrieves a vehicle that wasn't the last one in, the cars blocking it must temporarily move to the street so that the requested vehicle can leave. Write a program in Java that m..

  Write a program that ask the user to enter a usemame

Write a program usennuftevalidator.java that ask the user to enter a usemame and checks whether the usemame meets the following criteria

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd