CSCI 161 - Lab #6: Dives

Objectives

Write a program that calculates the score of a professional diver. Your program will read all of its data from a file. Each line of the file has the data for one scored dive. Each line of dive data has a dive number and a degree of difficulty factor along with the individual dive scores from seven (7) judges that each score the dive by assigning a real number between 0 and 10 (inclusive). Your program will total the scores for each dive, omitting the highest and lowest scores, then multiply this sum by a degree of difficulty (a real number between 1 and 4, inclusive), and lastly multiply that result by 0.6 to achieve a total score for a given dive. Each diver might perform multiple dives. Your program will also calculate the overall score for a diver by averaging the scores of the individual dives.

Instructions

Following are the instructions and you should follow them carefully:

  1. Using Eclipse create a new Java Project and name it: Lab6
  2. As with all your labs and assignments, add a class of the same name, Lab6 , and include in that class a main method.
  3. Your program must read a file according to the "Input Specification" below.
  4. Your program must employ, among possible others, the methods described in the Required Methods section below.
  5. Your program must output according to the "Output Specification" below.
  6. Iteratively develop the assignment (get the original version working, test it, add code to one method, test, fix if needed, continue).
  7. When the lab is complete and working submit your Lab6.java file via AutoLab.

Required Methods

Following are a list of methods to use and/or write:

        
// For detecting the high and low scores (use these, Google for their usage)
Math.max
Math.min

// Print the introductory message (write this)
void printIntro()

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

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

Input Specification

Your program must read from the file "DiveData.txt" (spelled exactly as shown) and that file should be in the current working directory. You can 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 as follows:

        
<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
        
        

Feel free to test with the lines above in your "DiveData.txt" file, or feel free to use any other data that conforms precisely to the file format described above.

Output Specification

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

Your program should output precisely according to the format below (wording, spacing, punctuation, precision of doubles, etc).

            
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.
        
        

Deadline

This assignment must be submitted to the instructor by 11:59:59pm on Monday, October 23rd.