Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

slove this program in pycharm and put pictures for the output Q2. Create a class RegularPay that has the following data attributes pay Rate: float

slove this program in pycharm and put pictures for the output
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Q2. Create a class RegularPay that has the following data attributes pay Rate: float (KWD per hour) name: String The class should also have: a constructor that initializes the name and pay Rate. 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 hazard Rate*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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions

Question

13. Repeat Exercise 12 supposing that 502.8 in addition to 427.5.

Answered: 1 week ago