Question: For Python 3 Modify this code to include an employee class. You need to write getters and setters for the name, hours, and rate instance
For Python 3
Modify this code to include an employee class. You need to write getters and setters for the name, hours, and rate instance variables. The setters for hours and rate should validate the data (make sure it is greater than 0). Make sure to use the setters. I should not be able to use a method to set a negative value for hours or rate. The get_input and calc_pay functions should become methods of the class. They will need a few modifications. The get_input function should set the appropriate instance variables instead of returning them. The calc_pay will no longer need arguments because hours and hourly rate are now instance variables. Include a comma with two percent for the money. The total and average is required just like the sample
Sample Run:
How many employees do you want to enter? 3
Enter a name: Guido van Rossum
Enter hours worked: 42.5
Enter hourly rate: 285.11
Guido van Rossum should be paid $12,473.56
Enter a name: Blaise Pascal
Enter hours worked: 45
Enter hourly rate: 294
Blaise Pascal should be paid $13,965.00
Enter a name: Charles Babbage
Enter hours worked: 51
Enter hourly rate: 268
Charles Babbage should be paid $15,142.00
The total amount to be paid is $41,580.56
The average employee is paid $13,860.19
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
