Purchase Solution

Program to Calculate Diver Scores

Not what you're looking for?

Ask Custom Question

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);
}
}

Purchase this Solution

Solution Summary

.java file attached contains a program that will take in judge scores and difficulty level and output a diver's final total.

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

C# variables and classes

This quiz contains questions about C# classes and variables.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.