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.
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}')
Comments
Leave a comment