Answered step by step
Verified Expert Solution
Question
1 Approved Answer
hello, I need help with this question. Using Python programming language ** Please check the sample output. Thank you** Q2. Create a class RegularPay that
hello, I need help with this question. Using Python programming language
Q2. Create a class RegularPay that has the following data attributes payRate: float(KWD per hour) name: String The class should also have: a constructor that initializes the name and payRate. a method computePay(hours) that returns the pay for a given amount of time (payRate*hour). Derive a class HazardPay from RegularPay. It has the following extra data attribute: hazard Rate: float It should: have a constructor that initializes the name, payRate, and hazard Rate overrides the computePay method. The new method should return the amount returned by the superclass method plus the hazardRate*hour. Create a testing class for your main program. In this class print a menu to ask the user to enter the information of the employees as shown in the output. Each employee should be added to a list whenever created. You should also allow the user to choose to print all employees' info, compute payment of one employee, or exit the program. Refer to the sample output in next page. Sample output What would you like to do? 1- Add Regular Pay employee 2- Add Hazard Pay employee 3- Print employees info 4- Compute payment 5- Exit 1 Enter employee name: Aisha Enter pay rate: 5 What would you like to do? 1- Add Regular Pay employee 2- Add Hazard Pay employee 3- Print employees info 4- Compute payment 5- Exit 3 The employees are: Aisha What would you like to do? 1- Add Regular Pay employee 2- Add Hazard Pay employee 3- Print employees info 4- Compute payment 5- Exit 2 Enter employee name: maryam Enter pay rate: 2 Enter hazard rate: 3 What would you like to do? 1- Add Regular Pay employee 2- Add Hazard Pay employee 3- Print employees info 4- Compute payment 5- Exit 3 The employees are: Aisha maryam What would you like to do? 1- Add Regular Pay employee 2- Add Hazard Pay employee 3- Print employees info 4- Compute payment 5- Exit 4 Enter the employee name: Aisha Enter the hours: 10 Aisha will be paid 50.0 What would you like to do? 1- Add Regular Pay employee 2- Add Hazard Pay employee 3- Print employees info 4- Compute payment 5- Exit 6 Invalid choice What would you like to do? 1- Add Regular Pay employee 2- Add Hazard Pay employee 3- Print employees info 4- Compute payment 5- Exit 1 Enter employee name: Noor Enter pay rate: 3 What would you like to do? 1- Add Regular Pay employee 2- Add Hazard Pay employee 3- Print employees info 4- Compute payment 5- Exit 3 The employees are: Aisha maryam Noor What would you like to do? 1- Add Regular Pay employee 2- Add Hazard Pay employee 3- Print employees info 4- Compute payment 5- Exit 4 Enter the employee name: Asmaa Enter the hours: 20 Asmaa was not found! What would you like to do? 1- Add Regular Pay employee 2- Add Hazard Pay employee 3- Print employees info 4- Compute payment 5- Exit 5 Process finished with exit code 0 ** Please check the sample output. Thank you**
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