Assignment 7: Streams Practice

Objective: To get experience using streams and parsing files in Java

Due: Before class on Friday. However, you should attempt to start the assignment before the exam to get some I/O practice.

Using Streams

Overview: Modify your Olympic Score generator so that the difficulty score and execution scores come from the user.

Using Scanner

From the user (the console), find out what the difficulty score is and the name of the file that contains the judges' execution scores. (Reminder: Look at the API for Scanner.) To simplify the program, you can assume a directory where the files are so that the user just has to enter the file name.

Parsing the Execution Scores from a File

Parse the execution scores from the file. Your program should handle if there are less than 6 scores in the file appropriately. (Are there any other special cases that you should handle?)

Example File: scores.dat

Example Output:

What is the gymnast's average difficulty score? 8.525
What file contains the gymnast's excecution scores? scores.dat
Gymnastics Score
----------------
        Judges Execution Scores: 8.0 8.3 8.4 8.7 8.7 9.2 
        Average Execution Score: 8.525
        Average Difficulty Score: 8.525
        The Final Score: 17.05

Reminder: Code Organization and Usability

Use methods as appropriate to organize your code and make sure you code is user-friendly (e.g., helpful error messages).

Turnin

Copy your code and execution scores files into an assign7 directory in your turnin directory.

Grading (100 pts)

You will be evaluated based on the following criteria: