I can't seem to understand why I cannot run this.
Please explain.
Thank you in advance.
#07/22/2010
#Write a program that will calculate a 20% tip and a 6%
#sales tax on a meal price. The user will enter the meal price
#and the program will calculate tip, tax, and the total.
#the total is the meal price plus the tip plus the tax.
#main function
def main():
print 'Welcome to the meal calculator program'
print
mealprice = input_meal()
tip = calc_tip(mealprice)
tax = calc_tax(mealprice)
total = calc_total(mealprice, tip, tax)
print_info(mealprice, tip, tax, total)
#this function will input meal price
def input_meal():
mealprice = input('Enter the meal price $')
mealprice = float(mealprice)
return mealprice
#calls mealprice
#this function will calculate tip at 20%
def calc_tip(mealprice):
tip=mealprice * .20
return tip
#calls tip
#this function will calculate tax at 6%
def calc_tax(mealprice):
tax = mealprice * .06
return tax
#calls tax
#this function will calculate tip, tax, the mealprice
#and the total.
def calc_total(mealprice,tip,tax):
total = mealprice + tip + tax
return total
#calls total
#this function will print tip, tax, the mealprice
#and the total.
def print_info(mealprice,tip,tax,total):
print 'The mealprice is $' , mealprice
print 'The tip amount is $' , tip
print 'The tax amount is $', tax
print 'The total amount for your evening is $', total
#calls main
main()