Answer to Question #297204 in Python for Dhea M. Maddela

Question #297204

Create a Python script that will compute the NET Salary of an employee from an input number of hours worked and the rate per hour. An additional 20% of the overtime pay if an employee worked for more than 40 hours of regular work.


Sample Output:

Hours Worked : 45

Rate (per Hour): 200

Basic Pay : 8000

Overtime Pay : 1000

Incentive : 200

NET Salary is 9200


I need the code to have an output as stated above.


1
Expert's answer
2022-02-13T04:02:29-0500
hours_worked = int(input('Hours Worked: '))
rate_per_hour = int(input('Rate (per Hour): '))
basic_pay = rate_per_hour * min(40, hours_worked)
print(f'Basic Pay: {basic_pay}')
overtime_pay = rate_per_hour * max(0, hours_worked - 40)
print(f'Overtime Pay: {overtime_pay}')
incentive = int(overtime_pay * 0.2)
print(f'Incentive: {incentive}')
print(f'NET Salary is {basic_pay + overtime_pay + incentive}')

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS