Checkout
checkout
view
Your Cart Your Cart: item(s)
Add to Shopping Cart
$2.19 Instant Download
Computer Science, Software Design and Architecture
Year 1

In the sport of diving, seven judges award a score between 0 and 10, where each score may be a floating point value.


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.
*


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

By OTA:  Yupei Xiong, PhD

OTA Rating:  4.8/5

Your Price:  $2.19  (original value ~$11.97)

What's included:

  • Plain text response
  • Attachment(s):
    • Diving.java
$2.19 Download Add to Cart

Add to Shopping Cart
$2.19 Instant Download
Scheduling Activities - Your friend is working as a camp counselor at a camp. He needs to organize activities for the kids. One of his plans is the following marathon: each contestant must swim 20 laps of a pool, then bike 10 miles, and then run 3 miles. The plan is to send the contestants out in a staggered fashion via the following rule: the contestants must use the pool one at a time. In other ...
Significant inversions algorithm - You are given a sequence of n distinct numbers A1, ... , An. An inversion is a pair i < j such that Ai > Aj. Call a piar (i, j) a significant inversion if i < j and Ai > 2*Aj. Give an O(n*log(n)) algorithm to count the number of significant inversions in the input sequence.
Define a class named HotDogStand - You operate several hot dog stands distributed throughout town. Define a class named HotDogStand that has a member variable for the hot dog stand's ID number and a member variable for how many hot dogs the stand has sold that day. Create a constructor that allows a user of the class to initialize both values. Also create a method named justSold that increment...
Give the definition of a class named Doctor whose objects are records for a clinic’s doctors. - Give the definition of a class named Doctor whose objects are records for a clinic’s doctors. This class will be a derived class of the class SalariedEmployee given in Display 7.5. A Doctor record has the doctor’s specialty (such as "Pediatrician", "Obstetrician", "General Practitioner", and so forth; s...
Java - Write a program that calculates the average of N integers - Please see attached file. When my exception is encountered I can't get the catch to operate correctly.

Page generated in 0.0145 seconds

About Us ·  Contact Us ·  Samples ·  Solutions ·  Legal Terms and Conditions ·  Privacy Policy

©2008 SolutionLibrary.com

Search for Solutions About Us Samples