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.
Overview: Modify your Olympic Score generator so that the difficulty score and execution scores come from the user.
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.
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
Use methods as appropriate to organize your code and make sure you code is user-friendly (e.g., helpful error messages).
Copy your code and execution scores files into an assign7
directory in your turnin
directory.
You will be evaluated based on the following criteria: