Home »
Python »
Python programs
Python program to calculate gross pay (Hourly paid employee)
Here, we are writing a Python program in which we will calculate the total payments made to the employee per day based on the hours worked.
Submitted by Shivang Yadav, on March 01, 2021
The payments made to the employee are based on the hours he has worked. Ideal working hours per day is 8 hours and for that 1500 is paid to the employee.
The calculation of salary based on hours worked is,
- Hours worked = 8, payment = 1500.
- Hours worked < 8, pay less, 75 per hour.
- Hours worked > 8, pay more, 75 per hour.
Python program to calculate gross pay
workingHours = int(input("Enter Working Hours: "))
if(workingHours == 8):
print("1500")
elif(workingHours >= 1 and workingHours < 8):
lessHours = 8 - workingHours
lessPay = ((1500*5)/100)*lessHours
totalPay = 1500 - lessPay
print("Less Hours:",lessHours)
print("Less Payment:", lessPay)
print("Total:",totalPay)
elif(workingHours > 8 and workingHours <= 14):
extraHours = workingHours - 8
extraPay = ((1500*5)/100)*extraHours
totalPay=1500 + extraPay
print("Extra Hours:",extraHours)
print("Extra Payment:", extraPay)
print("Total:",totalPay)
else:
print("Invalid Hours...")
Output:
Enter Working Hours: 12
Extra Hours: 4
Extra Payment: 300.0
Total: 1800.0
Python Basic Programs »
ADVERTISEMENT
ADVERTISEMENT