The National Rugby League (NRL) is a Rugby League competition played by professional players in sixteen teams from three states of Australia and New Zealand. The competition is played during autumn and spring for twenty-six rounds of matches with the top eight ranked teams then advancing to a finals series culminating in a Grand Final to determine the competition winner. The twenty-six competition rounds have been completed for 2015 with the final rankings of each team shown in Appendix 1. The ranking of each team on a weekly basis produces what is commonly known as the competition ladder.
For each round of the competition a series of matches are played between the sixteen teams. There are normally eight(8) matches played each round1 or more drawn matches). At the conclusion of each round the results from each match are gathered to produce the competition ladder in which each team is ranked according to the total number of competition points achieved to date(see Appendix 2 for a description of how competition points are achieved). Hence, at the completion of any given round the competition ladder may have different team rankings depending upon the total number of wins, losses and drawn Matches for each team. For teams that are on the same number of competition points a score differential is used to determine the correct rank (see Appendix 3 for an explanation). Hence, each round produces eight winning and eight losing teams (unless there is one)
-Some rounds have less than eight (8) matches since they are played as a split round. Your program cannot assume which rounds will be split nor how many matches will be in the split rounds. The maximum number of matches per round is eight (8).
In this programming project you will write an object-oriented menu-driven java program that is able to generate the competition ladder for any chosen round within the regular twenty-six round competition as described above. To do this your program will need to read data from the keyboard and from certain text files in secondary storage, store the data in appropriate data structures using objects, sort the data, and write output data to both the screen and to secondary storage. The specific functional requirements are described in section B(ii). The text files that are to be used for this programming project are described in section B(iii). The classes that must be used as a minimum are described in section B(iv). B(ii) - Program Requirements/Functionality
The Java program must
1. Display Match Schedule - when this menu option is selected the program should determine from the user if they want to view the schedule for all rounds of the competition or just a selected round. As a result of the users choice display the users selection of round(s) to the screen in a simple tabular format similar to that shown in Appendix 4.
2. Enter Round Results - when this menu option is selected the program should allow the user to enter the match results for a particular round. That is, the program will need to display the details for each match in the given round and obtain the score for the home team and the away team for each match. The results obtained for the round must then be written to the round#.txt file (the file format to be used is described in section B (iii)). The round to be processed by the user should be the next round which should be determined automatically by the program (ie, if rounds 1 to 5 have already been loaded/entered then the next round to be processed would be round 6). The results of the round should also be applied to the Team objects array so that each Team object is up to date thus ensuring that any output generated via menu option 3 is correct.
3. Display Ladder when this menu item is selected the program should display to the screen the current competition ladder. This will show the ranking of each team according to the match/round results that have been loaded/entered. This menu item cannot be chosen by the user if no rounds have been loaded/entered. Example output for the competition ladder is shown in Appendix 1. Notes: (i) As per the example shown in Appendix 1 the ladder must be displayed such that the highest ranked team is displayed at the top of the output followed by the team ranked second, then third, and so on until the lowest ranked team is displayed last; (ii) the data items to be displayed in this output are shown in Appendix 1.
4. Team Results when this menu item is selected the program obtains from the user the name of an NRL team for which they wish to view full match results from round 1 to the current round of the competition. The output generated for this menu item will display to the screen. An example of the output required is shown in Appendix 5.
5. Exit Program the program should terminate when this menu item is selected. The program should not terminate until this option is chosen. At other times the program should return to display the Main menu after completing the chosen menu option.
The data that is to be manipulated by your Java program in this programming task is contained in the text files
Teams.txt, Fixtures.txt, Round1.txt, Round2.txt,. . . Round26.txt. Examples of these files are found in the zip file for this programming project. The data within these text files will need to be read into memory by your program so that it may be manipulated to solve many aspects of the required functionality of this programming project. The text files have been created to conform to a particular format. The format for each file is described below:
File: Teams.txt
This file contains details of all of the teams that played in the 2015 NRL competition. Each line within this file represents an NRL team, and has the following format:
Team Name, Team Mascot, Home Ground
where each data item is separated by a comma (,).
A brief explanation of each of these data items:
Team Name: the name of the NRL team
Team Mascot: the mascot or emblem or commonly used name for the NRL team
Home Ground: the sports ground where the NRL team play their home games
File: Fixtures.txt
This file contains the details of all matches for each round of the NRL competition. This information is generated by the NRL prior to the start of the competition hence the results of each match are not known at the time this fixtures text file is created. Each line within the file represents a match (fixture/game), and has the following format:
Round Number, Match Number, Home Team, Away Team, Venue, Time, Date
where each data item is separated by a comma (,).
A brief explanation of each of these data items:
Round Number: numeric value indicating the round of the competition
Match Number: unique numeric value identifying the match (this value is unique across all rounds)
Home Team: name of team playing at home ground in this match
Away Team: name of team playing away from home ground in this match
Venue: name of the ground or stadium where the match is played (normally this will be the Home Teams home ground)
Time: time of kickoff (start) for the match
Date: date of the match
Important Notes: Most rounds of the NRL competition have eight (8) matches. However, some rounds may have less than eight (8) matches since some rounds are played as a split round. Your program needs to be able to cater for this. Your program cannot assume which rounds will be split nor how many matches will be in the split rounds. The maximum number of matches per round is eight (8).
Files: Round#.txt
At the completion of each round a results file is created. The file indicates the scores for each match in the round. The results file for each round is named Round#.txt where # is the round number. Hence, there can be up to 26 such files; one for each round of the competition. The files would be named consecutively Round1.txt, Round2.txt, .... up to Round26.txt. Each file contains a full record of the match results for the given round.
Important Notes: at the start of the competition none of the match results are known and as indicated above the results of the round are not produced until after completion of the round. Hence, if a result file for a round does not exist then that round has not yet been completed.
Each line within each file represents an individual match result, and has the following format:
MatchNumber Score1 Score2
A brief explanation of each of these data items:
Match Number: unique numeric value identifying the match
Score1: score achieved by the home team in the match
Score2: score achieved by the away team in the match
When reading the text files into memory the data should be read into appropriate array(s) of objects. The classes for these objects are briefly outlined in section B(iv).
To write your solution for this assignment it is a requirement that you write appropriate code for at least the following java Classes:
a) Team
b) Fixture
These classes are described in general terms as follows:
a) Team class: the Team class represents an individual NRL team. The Team class needs to store data for the Team Name, Team Mascot, Home Ground name, Rank, accumulated results for each match played during the season which includes number of games played, number of games won, number of games lost, number of byes, points scored For, points scored Against, total competition points. As well as the normal methods that should be created for a class (eg, constructors, mutators, and accessors) you will need to decide upon other appropriate methods for this class based upon the general requirements of the assignment specification.
b) Fixture class: the Fixture class represents an individual match in the NRL competition. The Fixture class needs to store data for the match number, round number, Home Team name, Away Team name, match date, match venue, match time, Home team score, Away team score. As well as the normal methods that should be created for a class (eg, constructors, mutators, and accessors) you will need to decide upon other appropriate methods for this class based upon the general requirements of the assignment specification.
Apart from the above two classes it is quite likely that you will also need to write other classes depending upon your solution method.
All txt files will be provided at the acceptance of this project.
Appendix 1 See image.
Appendix 2
For each match that a team plays they receives two (2) points for each win, zero (0) points for each loss, and one (1) point for each draw. A Bye is awarded two (2) competition points. Each team during the twenty-six (26) rounds will have two Byes.
Appendix 3
When two or more teams have accumulated the same number of total competition points the correct ranking of the teams is determined by using a score differential. The Score Differential is calculated as Points For minus Points Against (ie, diff = F - A). The team with a larger score differential is ranked higher than a team with a smaller score differential.
For example, in Appendix 1 Brisbane Broncos (rank 2) are ranked ahead of North Queensland Cowboys(rank 3) since their points differential (574 379 = 195) is greater than the points differential (587 454 = 133) of North Queensland Cowboys even though they both have the same number of total competition points (38).
Appendix 4 Example Menu Item 1 See image.
Appendix 5 Example For menu item 4 See image.