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

Audio and Graphics Manipulation in Java
Homework Solution
$110.00
Computer Science
Java Programming
Audio Manipulation
3D Graphics
Functions
Stream
Sample Rate
Pseudocode
Happy Birthday Tune
Notes
Effects
Cubs
Origin
Green Boxes
Axis
Geometry
Opposite Sides
Furniture Shop Using Java Programming
Homework Solution
$65.00
Computer Science
Java Programming
Furniture Shop
NetBeans
Color
Price
Radio Buttons
Combo Box
File Management
Panels
Searching
Categories
Classes
Items
Programming Problems Using Netbeans
Homework Solution
$30.00
Computer Science
Java Programming
Netbeans
Accounts Data
Balance
Arrays
Integers
Byte-Based Stream
Functions
Classes
Variables
Statements
Java Programming Problems: Computer-Assisted Instruction
Homework Solution
$45.00
Computer Science
Java Programming
Computer-Assisted Instruction
Education
Multiplication
Integers
Students
Random Objects
Execution
Fatigue
Switch Statement
Percentage
Sudoku Game Using Java
Homework Solution
$20.00
Computer Science
Java Programming
Sudoku
Array List
Algorithms
Game Board
Scores
Elements
Loops
Shuffling
Integers
Exceptions
Rules
Rock, Paper, Scissors Program in Java
Homework Solution
$75.00
Computer Science
Java Programming
Probability
Game
Winning
Rock Paper Scissors
MySQL
Tables
Statements
Strings
Integers
Computer Actions
Functions
Borders
Players
Database
Exceptions
HTTP Servlets
Get help from a qualified tutor
Live Chats