Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write in python You will open a restaurant that sells three items: Cold Pasta, Grilled Cheese, and Pie. Your restaurant will do the following: 1.
write in python
You will open a restaurant that sells three items: Cold Pasta, Grilled Cheese, and Pie. Your restaurant will do the following: 1. Ask the user if they want Cold Pasta, Grilled Cheese, and Pie - See prices in example below - In all cases, you are prompting them for a yeso answer. For yes they can type ' y ' or ' Y ', and for no they can type ' n ' or ' N ' - If they want an item, find out how many - The user must not be allowed to order less than zero of an item, if they do, simply set the amount they order to zero. 2. Ask them for their age, this will affect the discount - Anyone 55 or older gets a 55% senior citizen discount off the total cost (After tax is applied) - Anyone 5 or younger gets all the pie they want for FREE (should not be in total nor taxed)! 3. Display a cost per item (before any discounts), a subtotal (before any discounts), a tax amount, a discount amount, and a grand total - Tax is 8% Sample run: WELCOME TO THE RESTAURANT Do you want cold Pasta? (y):y How many?: 10 Do you want Grilled Cheese? (y):Y How many?: 5 Do you want Pie? (y):y How many?: 2 How old are you?: 55 10 Cold Pasta@2.50 25.00 5 Grilled cheese@5.55 27.75 2 Pie@3.00 6.00 Subtotal: $63.45 Tax: $4.70 Discount: $34.90 =========================== Total: $28.55 Please come again! WELCOME TO THE RESTAURANT Do you want cold Pasta? (y):n Do you want Grilled cheese? (y):n Do you want Pie? (y):y How many?: 99 How old are you? : 4 0 cold Pasta@2.50 0.00 0 Grilled cheese @5.55 0.00 99 Pie@3.00 0.00 Subtotal: $0.00 Tax: $0.00 Discount: $0.00 ====*==:==:==:==:===:==:===:= Total: $0.00 Please come again! NOTE: For the rounding to two digits any of the following: Use the formatted string option total =9.283857 \#example total print(f"Total: ${ total:0.2f } ") \#prints Total: $9.28 Using the built in round method can work, but won't provide the extra zero for trailing zeros. pi =3.14159 pi_approximation = round (3.14159,2)# rounds to 3.14 price =2.00 print ( round ( price, 2) ) \#print 2.0 instead of 2.00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started