CSc 103
Programming Problem - Golf Pool Winner
The Atascadero country club has a golf "pool". Each golfer
pays $10 to participate in the pool. At the end of the month,
the person with the lowest average score wins the money in the
pool. To be eligible to win, a golfer must play at least three
rounds of golf during the month. You have been hired to write a Java
program to compute the monthly winner.
You are given a text data file
that contains records
of all golfers for the month. Each record (line of the
file) has three fields, separated by a semicolon. The first
field
is the name of the person who completed a round of golf. The second
field is the date on which they played. The third field is the
score earned on that round.
You are to write a program to read the data file and determine the
golfer with the lowest average score (who has played at least three
rounds). If two golfers have the same average, the one
who has played the most rounds is the winner. (You may assume
there will be no ties.)
Also compute the number of rounds of golf played by the winning
golfer.
The output (standard output) contains the golfer's name, average
score (displayed with one decimal point), and number of rounds
played.
The filename of the data file is provided to the program as a
parameter on the command line.
Example command line:
java GolfPool jun2010scores.txt
If the program can't find a file with that name in the current
directory, display a helpful error message.
Sample Input File
Dan Jones;5/14/2010;87
Sara Von Fleet;5/15/2010;73
Tim O'Hara;5/1/2010;93
Tim O'Hara;5/3/2010;89
Tim O'Hara;5/12/2010;91
Joe Bob Billings;5/18/2010;83
Sara Von Fleet;5/5/2010;75
Dan Jones;5/21/2010;85
Sara Von Fleet;5/8/2010;77
Sample Output
Winning golfer: Sara Von Fleet
Average score: 86.5
Number of rounds: 3