QuestionQuestion

Upload UML Diagram, Algorithm, Diver and Tester (or Driver depending on the UML diagram) – the two .java files. All methods must have appropriate javadoc comments.
The main is to create and open the input file (Divers.txt) to read the number of divers. For each diver call class methods to:

• Read the diver's name from the file.
• Input the ten scores.
• Find the lowest and highest score.
• Calculate the total points by dropping the lowest and highest score.
• Output the diver's name, the scores, total points and average score (formatted with 2 places after the decimal) with appropriate column headings. Output is to line up (i.e. format the output).
• Find the winner and output the name at the end of the contest.

Judges.txt has the judge results if students would rather read a file than input the data. The first record is the number of judges. The remaining records are the scores for each diver.

Input file Divers.txt contains the following:
5
Baker, Nancy
Johnson, Anne Marie
Marshall, Debra
Smith, Jean
White, Kristina

Judges.txt contains the following:
10
100 98 80 92 99 86 90 92 90 95
92 91 88 95 100 88 92 94 89 95
100 78 89 100 97 85 91 95 92 93
94 95 70 92 100 100 98 97 94 95
70 97 85 90 95 90 100 100 96 96

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.util.Scanner;

public class Divers {

private int[] scores;
private int judges;
private int total;
private String name;

public Divers() //Initialize data
{
scores = new int[0];
total = 0;
judges = 0;
}

public void readName(Scanner input) //Read name from file
{
name = input.nextLine();
}

public void readScores(Scanner input, int count)
{ //Read scores from scanner object passed in
judges = count;
scores = new int[judges];
for(int i = 0; i < judges; i++)
scores[i] = input.nextInt();
}

public void calcTotal()
{
int minIndex = 0, maxIndex = 0;

for(int i = 0; i < judges; i++) //Figure out min and max
{...
$20.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats