Write a Fast Food program in Python that uses functions to display a menu of ite
ID: 3921881 • Letter: W
Question
Write a Fast Food program in Python that uses functions to display a menu of items to the user,
takes the order, and calculates the total.
The user selects which item they would like and how many of that item they would
like.
The user continues to enter items until they are finished. Once they have signified that
they are done, calculate the total cost and display it to the user along with the total
number of items.
Write the following functions
:
1.
Display the menu option
s
–
you can use the example below, or make up your
own items and prices. Have at least three items to sell.
2.
Check
the user’s
menu
input to make sure that
what they enter is valid (ie. an
integer within the menu’s range
).
3.
Check the user’s quantity input to
make sure that what they enter is valid (ie. a
positive integer).
4.
Pass in the price of the item and the quantity, return the cost for those items.
5.
Pass in the cost for those items and the subtotal so far, add the cost to the
subtotal, then return the new
subtotal.
6.
Pass in the subtotal, compute the price of tax and return it. Tax for this
restaurant is 9%.
7.
Pass in the subtotal, tax, and total number of items. Calculate the final total,
and then display the subtotal, tax, and final total, all with decimal
formatting.
Example Output:
MacDoogle’s:
1. Hamburger =
$1.50
2. Soda =
$1.15
3. Fries =
$1.25
4. Complete Order
1
Enter Number of Hamburgers: 2
MacDoogle’s:
1. Hamburger =
$1.50
2. Soda =
$1.15
3. Fries =
$1.25
4. Complete Order
1
Enter Number of Hamburgers: 2
MacDoogle’s:
1. Hamburger =
$1.50
2. Soda =
$1.15
3. Fries =
$1.25
4. Complete Order
2
Enter Number of Sodas: 1
MacDoogle’s:
1. Hamburger =
$1.50
2. Soda =
$1.15
3. Fries =
$1.25
4. Complete Order
4
Su
btotal:
$4.15
Tax:
$0.37
Total Cost: $4.52
Number
of items: 3
Enjoy Your Meal!
Explanation / Answer
price = [5.0, 6.5, 4.5 ] item_name = ["Coffee Time", "Burger", "Pizza" ] def display(): i = 1; for item in item_name: print str(i) + " " + item + " = " + str(price[i - 1]) i += 1 print str(i) + " Complete Order." def check(inp): if inp < 1: print "Item number should not be less than 1." return False; if len(item_name)+1Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.