A football team has Players. There are Goalkeepers, Defenders, Midfielders and Attackers. Each Player has:
A bonus is paid at the end of the year and is 10% of their monthly salary.
Design a superclass called Player that will define every kind of player in the team. Make sure your superclass has all of the instance variables common to all kinds of players and also design accessor methods for those variables.
Design a method called addBonus() which adds the player's bonus to the player's salary when it is called.
Design the 4 different subclasses.
In a main program, construct different kinds of players. Test that the data is being stored correctly by calling the accessor methods you designed. Test the addBonus() method for different types of Player and check that their salary has increased correctly.
Goalkeepers receive a different bonus. They receive 20% of their salary. Write a new method in the Goalkeeper class which over-rides the super class's addBonus method to cater for this situation.
Is it possible to have an array of 11 Player objects?
Can we add different types of Player to the array eg a Goalkeeper, 4 Defenders, 4 Midfielders and 2 Attackers (Alex Ferguson's favourite formation)
Could we then write some code to count how many of each type of Player is in the team?
Research this and submit your solution with your other code.