Taking a Restaurant Order: Sentinel Style. Using the restaurant menu you selected in assigment below , you will create a program that will take an order from a customer and calculate the total. Your program shall, Display the menu with the prices. Take an order using the Sentinel approach in section 5.2.5 (atatched)  The user will input numbers between 1 and 10, according to the menu you created below. Use zero as sentinel value (see Listing 5.5, p. 141) Inform the user about invalid input values (greater than 10 or less than 0) Add the prices of the dishes ordered  After taking the order, the program displays the subtotal, the sales tax (8.75%), the grand total, and a suggested 15% tip.   You can use the program you created below and modify to incorporate the new requirements. Notice that you will still need the multi-way conditional to add the right price value to the running total of the order.     import sys #Enter number for each dish and price for users DishNumber= float(input("Enter numbers between 1 and 10:")) if DishNumber == 1: print("Cajun Calamari price is $9.00") elif DishNumber== 2: print("Shrimp Cocktail price is $9.00") elif DishNumber== 3: print:("Spicy Garlic Mussels price is $9.00") elif DishNumber== 4: print("Crispy Ahi price is $10.50") elif DishNumber== 5: print("Spinach Artichoke Dip price is $8.00") elif DishNumber== 6: print("Steamed Clams price is $10.00") elif DishNumber== 7: print("Chips and Dip price is $6.50") elif DishNumber== 8: print:("Beer Battered Ribs price is $6.00") elif DishNumber== 9: print("St.Louis Ribs price is $8.00") elif DishNumber== 10: print("Mozzarella Sticks price is $7.00") else: print("Error: Select number between 1 and 10")

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Taking a Restaurant Order: Sentinel Style. Using the restaurant menu you selected in assigment below , you will create a program that will take an order from a customer and calculate the total.

Your program shall,

  • Display the menu with the prices.
  • Take an order using the Sentinel approach in section 5.2.5 (atatched)  The user will input numbers between 1 and 10, according to the menu you created below.
  • Use zero as sentinel value (see Listing 5.5, p. 141)
  • Inform the user about invalid input values (greater than 10 or less than 0)
  • Add the prices of the dishes ordered 
  • After taking the order, the program displays the subtotal, the sales tax (8.75%), the grand total, and a suggested 15% tip.

 

You can use the program you created below and modify to incorporate the new requirements. Notice that you will still need the multi-way conditional to add the right price value to the running total of the order.

 

 


import sys

#Enter number for each dish and price for users

DishNumber= float(input("Enter numbers between 1 and 10:"))

if DishNumber == 1:
print("Cajun Calamari price is $9.00")

elif DishNumber== 2:
print("Shrimp Cocktail price is $9.00")

elif DishNumber== 3:
print:("Spicy Garlic Mussels price is $9.00")

elif DishNumber== 4:
print("Crispy Ahi price is $10.50")

elif DishNumber== 5:
print("Spinach Artichoke Dip price is $8.00")

elif DishNumber== 6:
print("Steamed Clams price is $10.00")

elif DishNumber== 7:
print("Chips and Dip price is $6.50")

elif DishNumber== 8:
print:("Beer Battered Ribs price is $6.00")

elif DishNumber== 9:
print("St.Louis Ribs price is $8.00")

elif DishNumber== 10:
print("Mozzarella Sticks price is $7.00")

else:
print("Error: Select number between 1 and 10")

# Prompt the user for confirmation continueloop
input ("Enter Y to continue and N to quit: ")
You can rewrite Listing 5.4 with user confirmation to let the user decide whether to advance
to the next question.
5.2.5 Controlling a Loop with a Sentinel Value
Another common technique for controlling a loop is to designate a special input value, known
sentinel value as a sentinel value, which signifies the end of the input. A loop that uses a sentinel value in sentinel-controlled
loop this way is called a sentinel-controlled loop.
The program in Listing 5.5 reads and calculates the sum of an unspecified number of
integers. The input 0 signifies the end of the input. You don't need to use a new variable for
each input value. Instead, use a variable named data (line 1) to store the input value and
use a variable named sum (line 5) to store the total. Whenever a value is read, assign it to
data (line 9) and add it to sum (line 7) if it is not zero.
LISTING 5.5 SentinelValue.py
data
eval(input("Enter an integer (the input ends
input data
+
2
"if it is 0): "))
4
# Keep reading data until the input is 0
sum = 0
while data != 0:
loop
7
sum += data
8
9.
data
eval(input("Enter an integer (the input ends
+
10
"if it is 0): "))
11
12 print("The sum is", sum)
output
result
Transcribed Image Text:# Prompt the user for confirmation continueloop input ("Enter Y to continue and N to quit: ") You can rewrite Listing 5.4 with user confirmation to let the user decide whether to advance to the next question. 5.2.5 Controlling a Loop with a Sentinel Value Another common technique for controlling a loop is to designate a special input value, known sentinel value as a sentinel value, which signifies the end of the input. A loop that uses a sentinel value in sentinel-controlled loop this way is called a sentinel-controlled loop. The program in Listing 5.5 reads and calculates the sum of an unspecified number of integers. The input 0 signifies the end of the input. You don't need to use a new variable for each input value. Instead, use a variable named data (line 1) to store the input value and use a variable named sum (line 5) to store the total. Whenever a value is read, assign it to data (line 9) and add it to sum (line 7) if it is not zero. LISTING 5.5 SentinelValue.py data eval(input("Enter an integer (the input ends input data + 2 "if it is 0): ")) 4 # Keep reading data until the input is 0 sum = 0 while data != 0: loop 7 sum += data 8 9. data eval(input("Enter an integer (the input ends + 10 "if it is 0): ")) 11 12 print("The sum is", sum) output result
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY