Question
Specifically, you will create a program for organizing AFL team members, teams, and results. Part I: ALTeamMember (10 marks) You will implement a class AFLTeamMember.
Specifically, you will create a program for organizing AFL team members, teams, and results.
Part I: ALTeamMember (10 marks)
You will implement a class AFLTeamMember. Each team member (players, coaches, etc.) has a name and a position
You will implement this class, including getter and setter methods as appropriate. The positions on an AFL team are as follows: FB, HB, C, HF, FF, FOL, IC, COACH. Therefore, check if the value of Dosition is relevant betore setting in the setter
Also, write a toString method to have String representation of an AFLTeamMember as follows: "FirstName LastName, POSITION". For example, "Simon Goodwin, COACH"
Part II: AFLPlaver (10 marks)
You will implement a class AFLPlaver. This will be a child class of AFLTeamMember. Each AFLPlayer, in addition to having a name and a position, will also have a number, and may or mav not be a captain You will implement this class, including getter and setter methods as appropriate. However, for setting the value of number, it is required to check if the number is a valid positive number.
The String representation of an AFLPlayer should be as follows "
[Number] FirstName Last Name, POSITION", followed by "(c)" if that player is a captain. For example, "[1] Adam Treloar, HF", or "[11] Max Gawn, FOL (c)".
Part III: ALTeam (10 marks)
You will implement a class AFLTeam. Each team has a name, a coach (which is an instance of AFLTeamMember), and a lineup consisting of
22 AFLPlavers.
You will Implement this class, including getter and setter methods as appropriate. Also write a
toString method to get current value of all the attributes of this class.
Part IV: AFLMatch (15 marks)
You will implement a class ALMatch. An AFL match has two AFLTeams home Team and awav Team, and the score attributes for each team. In an AFL match, each score can either be a goal worth b boints. or a benind. worth " point. You wi need to keep track ot these separate v. as in the number of homeGoals, the number of homeBehinds, the number of awayGoals, and the number of awayBehinds. This class will also contain main) method and another method to load the lineup You will implement this class, including getter and setter methods as appropriate.
Part V: Load in the lineups (25 marks)
To load the lineups of the two teams, you will accept as input at the command line the names of two files. The first filename will be the name of a file the home team's lineup, and the second filename will be the name of a file containing the away team's lineup.
For example, you would start the program as:
> java AFLMatch MelbourneDemons.txt WesternBulldoas.txt
File names must be passed as arguments to the main method.
This would load the home team's
Ineup trom
MelbourneDemons.txt. and the awav team's lineup tram
WesternBulldogs.tt. These two files are provided to you for testing; the content of WesternBulldogs. txt is included here:
Western Bulldogs
Luke Beveridge, COACH
10, Easton Wood, FB
42, Alex Keath, FB
15, Taylor Duryea, FB
35, Caleb Daniel, HB
12, Zaine Cordy, HB
31, Bailey Dale, HB
6, Bailey Smith, C
21, Tom Liberatore, C
7, Lachie Hunter, C
19, Cody Weightman, HF
33, Aaron Naughton, HF
1, Adam Treloar, HF
39, Jason Johannisen, FF
44, Tim English, FF
29. Mitch Hannan. FF
8, Stefan Martin, FOL
11, Jack Macrae, FOL
4, Marcus Bontempelli, FOL, C
34, Bailey Williams, IC
5, Josh Dunkley, IC
37, Roarke Smith, IC
13, Josh Schache, IC
These files consist of name of team, COACH and 22 players (among them 1 is captain) details.
Before the game starts loadup both teams homeleam and awayleam.
However, it the number of players is less than 22 in any team, a relevant error message should be printed, and match should not start.
Part VI: Run the game (20 marks)
You will use a loop to take input from the user, who is the
"scorekeeper." This loop will prompt the user to tune one letter to indicate which team scored. "h" for the home team or "a" for the awav team. It wil then prompt the user to tvpe one etter to indicate the tvpe of score: "g" for goal or "b" for behind. This loop will keep running until the user types ', to indicate full time (the end of the match). In action, the loop might look like this:
Which team scored? h
Goal or behind? b
The current score is 0.1 (1) to 0.0 (0).
Which team scored? a Goal or behind? g
The current score is 0.1 (1) to 1.0 (6).
Which team scored? h
Goal or behind? g
The current score is 1.1 (7) to 1.0 (6).
Which team scored? h
Goal or behind? b
The current score is 0.1 (1) to 0.0 (0).
Which team scored? a Goal or behind? g
The current score is 0.1 (1) to 1.0 (6).
Which team scored? h
Goal or behind? g
The current score is 1.1 (7) to 1.0 (6).
Which team scored? h
Goal or behind? b
The current score is 0.1 (1) to 0.0 (0).
Which team scored? a Goal or behind? g
The current score is 0.1 (1) to 1.0 (6).
Which team scored? h
Goal or behind? g
The current score is 1.1 (7) to 1.0 (6).
Which team scored?
FULL TIME
Melbourne Demons 1.1 (7) defeated Western Bulldogs 1.0 (6).
For example, if current score is 1.10, it means 1 goal and 10 behind so fina score would be
6+10=16.
Please supply screenshots o the output o your program
Part vIl: lest Results for invalid input 10 marks)
Please supply screenshots for the output ot your program for invalid input values - that is inputs other than "h", "a", "b", "g", or'" entered in the scorekeeping loop.
(*** give a valid java running program with the ss of the output and the whole code accepting all the condition given in the question***)
The output should be like this in the given picture and please make sure all classes are together and it runs!!!! last time I got the solution with a lot of errors and it was not compiled and in different parts. So please please please make sure it runs and all are together!!!!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started