Team ABC approaches you to design for them a payroll system that will later be converted into an application The design must show all the classes and interface and the relationship existing between them.
Defender get bonus rate based on the number of games played which is 20%, Goalkeepers number of clean sheet 10%,Middlefielder of assist 10&, Strikers number of goals scored.
The payroll must have the following functionalities
1. Given a list of players, the system must determine and store the total payment of each player in a list.
2. Given a list of salaries for players, the system must determine the monthly costs of the team
3. Given a list of player , the system must determine the best monthly striker.
Create class Player as parent class.
Declare name_of_player inside the Player class.
Create Striker, GoalKeepers, and Mildfielder as children classes.
The classes Striker,Defenders, GoalKeepers, and Mildfielder should inherit name_of_players
the parent class. In each class apart from the parent class, declare a method
that calculate the monthly earning of a player
In the class Stricker, declare a method earning that takes the player name and
number of goals scored and return the player earning.
In the class GoalKeepers, declare a method amount that takes number of clean
sheets matches and return 10% of them.
In the class Defender, also declare a method earning that takes number of
games played by a player and player and returns 0.2 *number_of_games_played.
In the MildFielder class, define a method earning that takes the the number of assists
in games played by a player and the returns 0.1 * assist.
In the main function, Declare an array to store the names of players.
Declare arrays to store the earnings of players i.e an array for strikers, mildfielders
goalkeepers, and defenders.
Get the sum of each array to find total cost of the team.
Find the maximum in all the arrays.
The maximum in all the arrays will be best player.
Comments
Leave a comment