Python Salary Program Using Conditionals -
i error @ line 19, bonus function , can't figure out why. i'll error other functions too. i've checked spaces, numbers vs. strings, , dom. first problem globals , fixed global comrate
`comrate = 0; . i've got debugging blindness. thank guys in advance!
def main(): #welcome user , sales number print("welcome bonus qualification calculator! please answer following questions:") name = str(input("what name? ")) sales = float(input("what sales total? ")) jobtime = float(input("how many months have been company? ")) vacationtime = float(input("how many vacation days have taken? ")) #define global vars comrate = 0; compedsalary = 0; bonussalary = 0; finalsalary = 0; #begin calculations bonus(sales, jobtime) vacation(vacationtime) print(str(name) + ", salary based on information provided " + str(format(finalsalary,'.2f')) def bonus(sales,jobtime): #calcultate commission if sales < 10000: comrate = 0 elif sales > 10000 , sales <= 1000000: comrate = .02 elif sales >= 100001 , sales <= 500000: comrate = .15 compedsalary = float(comrate * 2000) if jobtime > 3: bonussalary = float(compedsalary + 1000) else: print("you don't qualify bonus due limited time @ company.") elif sales >= 500001 , sales <= 1000000: comrate = .28 compedsalary = float(comrate * 2000) if jobtime > 3: bonussalary = float(compedsalary + 5000) else: print("you don't qualify bonus due limited time @ company.") elif sales > 1000000: comrate = .35 compedsalary = float(comrate * 2000) if jobtime > 3: bonussalary = float(compedsalary + 100000) elif jobtime > 60: bonussalary = float(compedsalary + 101000) else: print("you don't qualify bonus due limited time @ company.") def vacation(finalsalary): if vacation > 3: finalsalary = float(bonussalary - 200) else: finalsalary = bonussalary main()
you're using full quotes should using apostrophes. you're using contractions in print statements, confuses python. put "do not" instead of "don't" in print statements.
Comments
Post a Comment