Q:

Python program to calculate gross pay (Hourly paid employee)

0

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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now