Classwork:
Scope: Local
#####################################
# NO Imports
#####################################
#####################################
# G.Elia
# Mail Order application with functions
# Python 3.5
# today's date
#####################################
print("This is an order form for a mail-order house.")
#####################################
# Functions' Definitions
#####################################
def initializeTotal():
totalinit = float(0)
return totalinit
def productPrompt():
product = int(input("Product number? "))
return product
def quantityPrompt(product):
quantity = int(input("Quantity? "))
if product == 1:
subTotal = quantity * 2.98
elif product == 2:
subTotal = quantity * 4.50
elif product == 3:
subTotal = quantity * 9.98
elif product == 4:
subTotal = quantity * 4.49
elif product == 5:
subTotal = quantity * 6.87
return subTotal
def final (total):
print("Total Price:",total)
##############################################
# main - Driver: control the flow of execution
##############################################
yesNo = 'y'
totalInit = initializeTotal()
while yesNo == 'y':
product = productPrompt()
totalInit += quantityPrompt(product)
yesNo = input("Do you want to continue? (y/n) ")
final(totalInit)
## input/output
##>>>
##This is an order form for a mail-order house.
##Product number? 1
##Quantity? 2
##Do you want to continue? (y/n) y
##Product number? 2
##Quantity? 3
##Do you want to continue? (y/n) n
##Total Price: 19.46
##>>>

