Programming Assignment 5
Date Due: November 29, 2000
Design and implement an applet to process golf scores. The scores of four golfers are stored in a text file. Each line represents one hold, and the file contains 18 lines. Each line contains five values: par for the hole, followed by the number of strokes each golfer used on that hole. Determine the winner and produce a graphical chart showing how well each golfer did, compared to par.
You must at least do the following things for this program to receive full credit:
-The assignment must be an applet, not an application, with your class name being your lastname. For example, the first line of a program I did would be
public class kappers extends Applet
-Your input file name should be called golf.dat. I have my own golf.dat file I will use to
grade with, but you’ll need to make one to test your program with. This can be made simply in notepad, where
some example lines might be
3 3 4 5 4
5 5 5 6 4
If this were the first two lines of the file, then hole 1 has par 3, and golfer 1-4 made 3, 4, 5, and 4 on that hole, respectively. Then hole 2 has par 5, and golfers 1-4 made 5, 5, 6 and 4 on that hole, respectively. Make a file with 18 lines like this, and save it as golf.dat to test with. This is the format my golf.dat file will be in.
-Your applet should utilize some of the classes used in
chapter 8, like FileReader, BufferedReader and StringTokenizer. Listing 8.7 is a GREAT example to look at!
-You must catch the I/O exceptions they catch in listing 8.7, namely FileNotFoundException and IOException.
- You must graphically represent this golf game somehow in your applet – you have a lot of freedom here. You can depict it per hole, or just the final scores versus the total par of the course. You can depict this with some kind of colored bar chart (using lines and rectangles), or any way you would like. Be sure somewhere on your display it announces which golfer, golfer 1, 2, 3 or 4, was the winner.
- Use constants for the max number of holes and the max number of golfers
-Comment your code – name and SSN are a must!!
Be
sure to follow all instructions above to receive full credit!
Turn in a hard copy (print out) of your program to me in class the night the program is due. You must also send your program to me electronically, to my email address (kathleen@cs.ucf.edu). The subject line of your program should be Assignment #5 – emails without this subject will be returned. This is so I can distinguish them from questions you may have. You will be emailing me your .java file and .html file, so that I can compile and run them it my own. Do NOT just send me an html file or a url link – I need to be able to compile your code.
Be sure to name your class, your .java file, and your .html file all the same name as your lastname!!