Good morning, I'm learning some basic programming and fundamentals and I am having a hard time troubleshooting why a certain part of my code is not working. In my "calcTotal" function, my If, Else statements do not seem to be working. The program runs through, but the output is always 0's and no matter what the program reports that the cell phone minutes were not over minutesAllowed, even when you say that minutesUsed is more than allowed.
Any help would be greatly appreciated. I think my idententations are right, I just don't understand what I am overlooking.
Thanks in advance.
#Cellphone Minute Calculator
#main function
def main():
minutesAllowed = 0
minutesUsed = 0
totalDue = 0
minutesOver = 0
endProgram = "no"
while endProgram == "no":
#functions/modules
getAllowed(minutesAllowed)
getUsed(minutesUsed)
calcTotal(minutesAllowed, minutesOver, minutesUsed, totalDue)
printData(minutesAllowed, minutesUsed, totalDue, minutesOver)
endProgram = raw_input('Do you want to end program? (Enter yes or no): ')
while not (endProgram == 'yes' or endProgram == 'no'):
print 'Please enter a yes or no'
endProgram = raw_input('Do you want to end program? (Enter no to process a new set of scores): ')
def getAllowed(minutesAllowed):
minutesAllowed = input("Enter minutes allowed (Between 200 - 800): ")
while(minutesAllowed < 200 or minutesAllowed >800):
print "You must enter between 200 and 800"
minutesAllowed = input("Enter minutes allowed (Between 200 - 800):")
return minutesAllowed
def getUsed(minutesUsed):
minutesUsed = input("Enter minutes used: ")
while(minutesUsed <0):
print "You must enter 0 or greater"
minutesUsed = input("Enter minutes used: ")
return minutesUsed
def calcTotal(minutesAllowed, minutesOver, minutesUsed, totalDue):
extra = 0
if minutesUsed <= minutesAllowed:
totalDue =74.99
minutesOver = 0
print "You were not over your minutes for the month."
else:
minutesOver = minutesUsed - minutesAllowed
extra = minutesOver * .20
totalDue = 74.99 + extra
print "You were over your minutes by ",minutesOver
return totalDue, minutesOver
def printData(minutesAllowed, minutesUsed, totalDue, minutesOver):
print "-------Monthly Use Report ---------"
print "Minutes allowed were ",minutesAllowed
print "Minutes used were ",minutesUsed
print "Minutes over were ",minutesOver
print "Total due is $",totalDue
main()