dimanche 18 septembre 2016

Goal is to use if - then statements to calculate gross pay depending if they have overtime

I keep getting an error and my program will not run, I need to make sure my program is modular and have the if-then statements to figure out what gross pay equation to use.

BASE_HOURS = 40
OT_MULTIPLIER = 1.5

def main():
    hours = input("Enter the number of hours worked: ")
    payRate = input("Enter the hourly pay rate: ")
    calcPayWithOT(hours,payRate)

def calcPayWithOT(hours,payRate):
    if hours <= BASE_HOURS:
        theGrossPayNoOT = hours * payRate
        print("The gross pay is $ ", theGrossPayNoOT)
    if hours > BASE_HOURS:
        theGrossPayOT = (hours - BASE_HOURS) * OT_MULTIPLIER + (hours * payRate)
        print("The gross pay is $ ", theGrossPayOT)
main()

Aucun commentaire:

Enregistrer un commentaire