Arraylists of objects Arrays of components output formatting Reading from files
ID: 666850 • Letter: A
Question
Arraylists of objects
Arrays of components
output formatting
Reading from files
JUnit Tests
The College Football Playoff (CFP) is the new system in American college football that will determine a national champion for the NCAA Division I Football Bowl Subdivision (FBS) beginning in the 2014 season. It replaces the Bowl Championship Series (BCS) previously used that generated much controversyhttp://en.wikipedia.org/wiki/College_Football_Playoff - cite_note-McMurphy-1.[1] Unlike the BCS, the new format does not use computer rankings or polls to select the participants. Under the playoff, four teams play in two semifinal games, with the winners advancing to the new College Football Championship Game. Six bowl games — the Rose Bowl, Sugar Bowl, Orange Bowl, Cotton Bowl, Fiesta Bowl, and Peach Bowl — rotate as hosts for the semifinal games. A committee of 12 members including athletic directors, former coaches, administrators and others vote to select and seed the teams.[2]
You are to write an application to read the committee votes and select and seed the teams. For the sake of simplicity, the input file will include votes on only 10 teams, with one line per committee member. Since the voting is by secret ballot, the votes of each committee member will be anonymous.
Once the votes have been read, the application will show the rankings of the ten teams, along with their total votes (lower is better). The application will be able to show the detailed votes of each anonymous committee member for each team.
Since the CFP intends to provide weekly rankings as the season progresses, the user will be able to select other voting files and display the results.
Operation
· When the user selects the Read Votes button, the application reads the committee voting file.
· When the user selects the Rank Teams button, the application selects and seeds the teams and displays the output. If the user selects the Rank Teams button again, a new file will be read in and results displayed.
· When the user selects the Show Details button, the application will display the votes of each committee member for each team, listed in ranked order.
· When the user closes the frame or presses the Exit button, the application exits.
Specifications
Data Element – Team class
Create a Team class. It will contain instance variables for the team name, the votes for that team, and the sum of votes. It will include a getSumOfVotes method to retrieve the sum of the votes and a getVotes method to retrieve an array of votes. Provide a default no-argument constructor and a two-argument constructor whose arguments are the String name of the team and an array of integers that will hold the votes for the team.
Data Structure – An ArrayList<Team> of Team objects.
Data Manager – CollegeFootballPlayoffManager class
Create a CollegeFootballPlayoffManager class. It will contain an ArrayList<Team> of Team objects. Data Managers are in charge of adding to the data structure, deleting from the data structure, updating the data structure, retrieving information from the data structure and any other methods that involve the data structure as a whole. This Data Manager will provide methods to read the input file (readVotes) and return an ArrayList<Team> of teams in order of their voted ranking (rankTeams). Follow the Javadoc that I gave you for your CollegeFootballPlayoffManager class so that the JUnit test for this class will work correctly. Add any additional methods as required for your design.
GUI Driver
· It will contain a CollegeFootballPlayoffManager object.
· Use a JOptionPane at the beginning of the application to prompt the user to choose a file to read.
· Use the FileChooser class when to select a file to read.
· When the user selects the Rank Teams button, display the four selected teams by name in order (#1 through #4), and show their pairing (#1 vs #4, and #2 vs #3).
· When the user selects the Show Details button, display all 10 teams by name and sum of votes.
Data File – The data files will be text files with one header line and one line per committee member. The first list will contain the team names. Each subsequent line will be a sequence of 1 through 10, separated by commas. There will be several data files (the actual committee will vote seven times during the season, starting on Oct 28th.) The following shows the format of the input files.
Initial prompt at startup:
GUI at startup. Notice that buttons that are not relevant are grayed-out:
When “Read Votes” is selected, the user will be able to browse for an input file:
After reading the input file, the “Rank Teams” button is un-grayed:
When the user selects “Rank Teams”, the sum of the votes for each team is displayed under the team name, in ascending order (i.e., the committee votes by ranking the teams 1 to 10):
When the user selects “Show Details”, the votes of individual committee members are displayed under the team names, again in ascending order of total votes:
The user may toggle between the “Rank Teams” and “Show Details” buttons, switching views. If the user re-selects the “Read Votes” button, the application allows another choice of input files.
[1] http://en.wikipedia.org/wiki/Bowl_Championship_Series
[2] http://en.wikipedia.org/wiki/College_Football_Playoff
Explanation / Answer
obj.add("Yugesh") ;
obj.add("Karan") ;
obj.add("Vinod") ;
obj.add("Hitesh") ;
obj.add("Martin") ;
obj.add("Ashish") ;
obj.add("Rishu") ;
)
I only knows to enter the data or make the arraylist ,Arrayist object.
Thanks ,
Rishu
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.