Competency Exam 15-111/200

Assignment

A golf tournament consists of several matches which are scored individually. Each player computes their final score by summing the scores from each round. The lowest overall score wins. Consider the following data from a hypothetical two round tournament among three players.

Example:
            Tiger Woods 70 69
            Greg Norman 71 76
            Phil Mickelson 69 72

In this case Tiger Woods has a total score of 139 (70 + 69), Greg Norman has a total score of 147 (71 + 76), and Phil Mickelson has a total score of 141 (69 + 72). Since his score is lowest, Tiger wins this tournament. We should remove Greg and Phil from the roster leaving only the winner.

You will be implementing one method for a golf tournament: keepSmallest()

This is a method of the LinkedList class that will remove all the elements from the list except the smallest one according to compareTo().

Project files

Sample output

There are two input files that could be used with your class: golf1.txt and golf2.txt. Make sure you test your solution with both input files. Here is the sample output for both input files:

golf1.txt


Enter the name of the file: golf1.txt

The players in the tournament:

 Ernie, Els 70 67 137
 Tom, Watson 71 76 147
 Fred, Couples 73 73 146
 Nick, Faldo 75 67 142
 Tiger, Woods 70 69 139
 Stewart, Cink 74 70 144
 
Winner of the tournament:
 
 Ernie, Els 70 67 137

golf2.txt


Enter the name of the file: golf2.txt
 
Players in the tournament:
 
 Nick, Price 70 76 146
 Craig, Stadler 73 72 145
 Angel, Cabrera 68 71 139
 Phil, Mickelson 69 72 141
 Greg, Norman 71 76 147
 
Winner of the tournament:
 
 Angel, Cabrera 68 71 139