Pricing Program You have been tasked to write a program to determine the price f
ID: 3540215 • Letter: P
Question
Pricing Program
You have been tasked to write a program to determine the price for an order of pizzas.
The only details you have been given are below:
Users must choose only one type of pizza, but can choose any number of those same type to buy.
The program should give them the price for their order and ask if they would like to continue.
They can continue to buy as many pizzas as they desire, until they press a particular key on the keyboard (that you designate).
Use the following math for your pricing program):
Pizza Type
Price
Small Cheese
$5.75 each
Large Cheese
$7.75 each
Small Pepperoni
$6.00 each
Large Pepperoni
$8.00 each
Small Supreme
$8.00 each
Large Supreme
$10.00 each
Sample Functionality:
User Chooses Small Pepperoni
Program Asks user for the number of pizzas to buy
Output proper price
Allow end-user to buy again, or exit
REQUIREMENTS
At least one program module, containing all the price functions %u2013 six total functions. The price functions must return a value, the quantity times price.
A main program that imports your module(s) and uses the functions.
A menu that prompts the user to choose a pizza type and then enter the number to buy.
The menu must have an exit option.
Explanation / Answer
support.py
def printmenu():
print("select a option");
print("Pizza Type Price ");
print("1.Small Cheese $5.75 each");
print("2.Large Cheese $7.75 each ");
print("3.Small Pepperoni $6.00 each ");
print("4.Large Pepperoni $8.00 each ");
print("5.Small Supreme $8.00 each ");
print("6.Large Supreme $10.00 each");
print("7.Quit");
def evaluate(a,b):
arr=[5.75,7.75,6.00,8.00,8.00,10.00]
return arr[a-1]*float(b)
main.py
import sys
import support
k=1
Billcost=0.0
while(k==1):
support.printmenu()
print("Your Purchase : $"),
print("%.2f"% Billcost)
var=raw_input("Enter your Option : ");
if (int(var)==7):
k=0
else:
print("Number : "),
number=raw_input()
Billcost=Billcost+support.evaluate(int(var),int(number))
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.