Assignment Two
This assignment is to compute some statistics and output them in various ways. The data file contains the results of all games played in the Division I NCAA basketball tournament. Each line in the data file has the following format:
year:winning team name:winning team score:losing team name:losing team score
for example
1945:Kentucky:106:Florida State:81
1995:UCLA:92:FIU:56
The statistics to be compiled are the set of years each team participated, the total number of wins and the total number of losses. The statistics for each team are to be kept in a TeamStats object. Use a Map<String,TeamStats> (a TreeMap<String,TeamStats>) to map the team name to its statistics. Your program must do the following:
1. Read the data file and after the file has been read and the statistics have been compiled display the team names in alphabetic order along with their corresponding statistics (years, wins and losses) in a nice format. For the display use a JTextArea in a JScrollPane in a JOptionPane.
2. Construct a TreeSet<TeamStats> from the collection of TeamStats objects using a Comparator<TeamStats> object that orders them by the number of years they participated (highest to lowest) and in case the number of years are the same in alphabetic order of their name. Display the information like in 1. in the new order.
3. Finally construct a TreeSet<TeamStats> of the TeamStats objects using a Comparator<TeamStats> object that orders them in wins order (most to fewest). If the wins are equals then use the losses (fewest to most) and if the wins are equal and the losses are equal in alphabetic order of their name.
Use ncaa-test.data to debug your program. The complete file is ncaa2005.data. This assignment is due via e-mail on Saturday March 4th at 2:00.