CSCI 161 — Lab 10

Due: Friday, December 01, 2017 @ 5:00PM

Overview

Write a program to calculate the score of a professional diver. You will read all of the data from a file.

Seven judges score each dive by assigning a real number between 0 and 10 (inclusive). Total the scores, omitting the highest and lowest scores. Multiply this sum by a degree of difficulty, a real number between 1 and 4 (inclusive), and then by 0.6. This is the score for one dive. Each diver might perform multiple dives. Calculate the overall score for a diver by averaging the scores of the individual dives.

Use at least the REQUIRED METHODS listed below, with the exact same SPELLING for method names and parameters.

Input Specification

Create file DiveData.txt (SPELLED EXACTLY like this) as a text file WITHIN your diving project. If you forget how to do this, consult Lab 1. Assume the input file contains data for at least one dive, the dives are listed in order, and the file does NOT contain errors.

Each line will be formatted thus:

<Dive Number> <Difficulty> <Score 1> <Score 2> ... <Score 7>

The dives will ALWAYS be listed in order (1, 2, 3, etc.).

For example, the following lines contain data for two dives:

1 3.5 5.5 6.0 7.0 6.5 6.5 5.5 7.5
2 2.0 8.0 8.5 8.5 9.0 8.0 8.5 8.0

Use PRECISELY the file format described above.

Output Specification

Output an introductory message and then the scores for each dive.

Use PRECISELY the format below with the EXACT same SPACING and SPELLING. The calculations are based on the scores above. Use TWO decimal digits of precision.

Welcome to the Diver Scoring program. This program will calculate an
  overall score for a diver, based on individual dives.

The diver's score for dive 1 is 66.15.
The diver's score for dive 2 is 49.80.

The average score for these dives is 57.97.

Required Methods

// For omitting the high and low scores
Math.max
Math.min

// Print the introductory message
void printIntro ()

// Read each line from input file and output scores and average
void processDives (Scanner fileScanner)

// Calculate the score for one dive
//   Do *not* print any results in this method
double calculateDiveScore (String diveLine)

Other Requirements

Use at least TWO different types of loops in your program.

Do NOT declare seven different variables to hold the various scores. Do the processing in a loop.

Hints

Test your program thoroughly, using my data and your own. We will use our own data for testing so you need not submit your text file.

Submission

Please name your program Diving.java

Submit the Java source code file on Autolab under the "Lab 10" assignment.

Grading