CSCI 161: Diver Score
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)
NOTE: calculateDiveScore
does
not take the entire dive line. It should only accept a String
consisting of the difficulty and the seven scores (all information
except the dive number)
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 “Diver Score” assignment.
Grading
- 20 points will be awarded for having a well-formatted, well-documented source code file. This includes your name, date, description, and comments throughout the program. This also includes other style requirements, such as method naming conventions. NOTE: The autograder will not display these points.
- 10 points will be awarded for correctly eliminating the low- and high- scores
- 60 points will be awarded for having methods that do what they are expected to do with correct parameters and return types
- 10 points will be awarded for having proper output that matches EXACTLY
- NOTE: if your program does not compile/run, the highest score you will earn will be a 20/100