Guys,
What is wrong with my compution here when "hrs" entered is 45?
The end result expected si 498.75 but it keeps failing to compute second portion correctly (please see below and attached screenshot).
hrs = input("Enter Hours:")
h = float(hrs)
OvrTimehrs = float(hrs) - float(40)
HourlyRate = input("Enter Hourly Rate:")
OvertimeRate = input("Enter Overtime Rate:")
if float(h) <= 40 :
TotalPay = float(hrs) * float(HourlyRate)
if float(h) > 40 :
TotalPay = ((float(hrs) * float(HourlyRate)) + ((float(OvrTimehrs) * float(OvertimeRate) * float(HourlyRate))))
print(hrs)
print(OvrTimehrs)
print(TotalPay)
If I enter 45 the end result for second "if" statement is giving "TotalPay" of 551.25 when it should be 498.75.
Enter Hours:45
Enter Hourly Rate:10.5
Enter Overtime Rate:1.5
551.25
Thanks,
Alex