Pakistan Cricket Board (PCB) is looking for a solution to record the information about their different types of players. Under the contract of PCB there are three (3) different type of players. Suppose you are asked to develop a system, which input all the data of player and calculate & print the total scores and income of a cricket player of Pakistan cricket team. Each player is identified by name, CNIC, income and score. There are three types of players – Test, OneDay, T20. A player can be in all types but If player is not playing in any one or more types then you will input zero(0) for the data members of that class. Each type of Player gets paid using a different formula. OneDay Players are paid by their Monthly fixed salary of Rs.100,000/- per month, test players are paid by the number of hours they played at rate of Rs.2000/- per hour, while T20 players are being played by the number of matches they have played at the rate of 50000/- per match. Keeping in mind the above scenario, 1. Write the complete states and behaviors of child and parent classes 2. Write the constructor for each class. 3. Apply method overriding in child classes. 4. Exercise the main function to test these classes. Here is one of the Example Output if player is not playing T20: Enter Player Name:Shahid_Afridi Enter CNIC:12345-6783765-1 Enter Test Hrs:20 Enter Score in Test:10000 Enter salary_per_month:3 Enter Score in OneDay:5000 Enter no_of_matches in T20:0 Enter Score in T20:0 Player Records Added by Ahmed Raza (20-ARID-744) ----------------------------------------------------------- Player Name: Shahid_Afridi Player CNIC: 12345-6783765-1 Total Score is:15000 Total Income is:340000
Pakistan Cricket Board (PCB) is looking for a solution to record the information about
their different types of players. Under the contract of PCB there are three (3)
different type of players. Suppose you are asked to develop a system, which input
all the data of player and calculate & print the total scores and income of a cricket
player of Pakistan cricket team. Each player is identified by name, CNIC, income and
score. There are three types of players – Test, OneDay, T20. A player can be in all
types but If player is not playing in any one or more types then you will input
zero(0) for the data members of that class. Each type of Player gets paid using a
different formula. OneDay Players are paid by their Monthly fixed salary of
Rs.100,000/- per month, test players are paid by the number of hours they played at
rate of Rs.2000/- per hour, while T20 players are being played by the number of
matches they have played at the rate of 50000/- per match.
Keeping in mind the above scenario,
1. Write the complete states and behaviors of child and parent classes
2. Write the constructor for each class.
3. Apply method overriding in child classes.
4. Exercise the main function to test these classes.
Here is one of the Example Output if player is not playing T20:
Enter Player Name:Shahid_Afridi
Enter CNIC:12345-6783765-1
Enter Test Hrs:20
Enter Score in Test:10000
Enter salary_per_month:3
Enter Score in OneDay:5000
Enter no_of_matches in T20:0
Enter Score in T20:0
Player Records Added by Ahmed Raza (20-ARID-744)
-----------------------------------------------------------
Player Name: Shahid_Afridi
Player CNIC: 12345-6783765-1
Total Score is:15000
Total Income is:340000
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images