Thread: NCAATeamStatics
View Single Post
Old 01-16-2013, 10:00 PM   PM User | #1
adrixs3103
New to the CF scene

 
Join Date: Jan 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
adrixs3103 is an unknown quantity at this point
Exclamation NCAATeamStatics

Hi, i need help with this assignment, i got stuck, ASAP please
Assignment One




This assignment is to process a large data file. The file is ncaa2012.data which contains the results of all games played in the NCAA Division I basketball tournament. Each line of the file has the form:

year:winning team name:score:losing team name:score

for example:




1945:New York University:70:Ohio State:65

1995:UCLA:92:Florida International:56




When reading the file discard the year field and the two score fields.




I have created a class NCAATeamStats for you to use in this assignment. Use the link NCAATeamStats.java to download the class file.




This main class should read the data file using the Scanner class. Use the delimeter string “[:\n\r0-9]+”. Use an ArrayList<NCAATeamStats> object to collect the information. As you can see from above, each line of the data file has a winning team name and a losing team name. You should write a method




static int indexOf(String team, ArrayList<NCAATeamStats> teams);




that searches the ArrayList<NCAATeamStats> teams for a team name match and returns the index in the ArrayList of the matching NCAATeamStats object. If there is no match return -1.




After getting a team name from the file use the indexOf method to find a matching NCAATeamStats object if one exits. If it was a winning team then increment the wins. If a losing team increment the losses. If there is no match construct a NCAATeamStats object and add it to the ArrayList<NCAATeamStats> object. If it was a winning team then increment the wins. If a losing team increment the losses.




After the file is processed write a loop to interact with the user. Prompt the user for a team name using the JOptionPane.showInputDialog method. If the team name is in the ArrayList display the name, wins and losses by calling the toString method of the NCAATeamStats class.




See ArrayListMaxExample.java for hints.
adrixs3103 is offline   Reply With Quote