Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Java program for Sports League - Players, Clubs, and Matches
Answered

Java class for Players

This scenario covers sports leagues where teams of players compete against each other, such as in football.

A league (e.g. English Premier League) consists of a fixed number of clubs. Throughout a season of the league each club plays each other club and the result is recorded. Each club is awarded points for each match depending on the result, e.g. in football you get three points for winning, one for drawing and none for losing. At the end of the season the club with the most points wins the league. If two clubs have the same number of points, they are ranked by goal difference, which is the total number of goals they have scored minus the total number of goals they have conceded.

Each club (e.g. Newcastle United) has a squad of players, the size of which may vary from club to club. For each match that the club plays a team is selected from the squad. The team is always of a fixed size e.g. eleven in football.

Each player (e.g. Leon Best) has a date of birth and a height, and plays for one club. At the end of a league season, the player who has scored the most goals (i.e. has the largest goal tally) wins the Golden Boot trophy. 

A.Define a Java class to represent players. Provide methods to: 

1.create a player ; 

2.set and get the name, date of birth and height of the player;

3.add to the goal tally of a player ; 

4.get the goal tally of a player.

B.Define a Java class to represent clubs. Provide methods to: 

1.create a club;

2.set and get the name of the club;

3.add to the goals-scored tally of the club;

4.add to the goals-conceded tally of the club;

5.get the goal difference of the club;

6.add to the points tally of the club;

7.get the points tally of the club;

8.add a player to the squad of the club;

9.find out whether a player is in the club's squad;

10.find the average age of the squad;

11.find the average height of the squad

C.Define a Java class to represent matches. Provide methods to:

1.create a match;

2.set and get the time and place of the match;

3.set and get the clubs playing in the match;

4.record which players played and how many goals each player scored;

5.get the final score (e.g. Sunderland 0 – 1 Newcastle United);

6.get the final result (e.g. Newcastle win). 

EExtend your program in the following ways: 

1. Provide robust error checking, e.g. if a player is listed as scoring in a match, then they must be in the squad of one of the clubs. Also, each player must be in only one squad for each league.

2. Define a special type of player, the goalkeeper.

3. Find the best goalkeeper in the league. At the end of the season the best goalkeeper is the one who has the most clean-sheets (i.e. matches in which the team concedes no goals). 

support
Whatsapp
callback
sales
sales chat
Whatsapp
callback
sales chat
close