Question

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

This is only a preview of the solution. Please use the purchase button to see the entire solution

Related Homework Solutions

Explanation For Java Classes
Homework Solution
$30.00
Java
Programming
Computer Science
Codes
Classes
Inheritance
Comparator
Binary Matrix
Labels
Edges
Tree
Strings
LinkedList
Integers
Nodes
Temporary Storage
Statements
Variables
Species
HashSet
Iterator
Gradebook Using Java Programming
Homework Solution
$20.00
Java
Programming
Computer Science
Random Numbers
Scores
Students
Input
Output
Loops
Statements
Conditions
Average Values
Variables
Mathematics
LinkedList in Java
Homework Solution
$30.00
Java
Programming
Computer Science
LinkedList
Methods
Variables
Statements
Players
Game Results
Client Code
List Head
Positions
Nodes
Builder Dash Game in Java
Homework Solution
$163.00
Java
Programming
Computer Science
Codes
Algorithms
Classes
Timers
Statements
Variables
Moves
Instances
Graphics
Animations
Java Programming Assignment
Homework Solution
$40.00
Java Programming
Computer Science
Arrays
Dynamic Allocation
ArrayList
Constructor
Get help from a qualified tutor
Live Chats