Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a python program that will • Work as a point of sale system at a rodeo sna

ID: 3814783 • Letter: W

Question

Write a python program that will • Work as a point of sale system at a rodeo snack bar. • The snack bar sells only three items: sandwiches for $3.00, chips for $1.50 and drinks for $2.00. • All items are subject to an 8.25% sales tax. • The program will repeatedly display the following menu until the shift is closed - E is entered. • The program should keep a running total of the amount of the sale and the end of day total sales will be displayed when E is entered. • Only one item can be ordered at a time • The following menu will be displayed at all times: MENU S = sandwiches - $3.00 C = chips - $1.50 D = drink - $2.00 X = cancel the sale and start over T = total the sale. E = close the shift • If the sale is cancelled - X is entered, clear the running total and display the menu again. • When the sale is totaled - T is entered, calculate the sales tax due and OUTPUT the number of all the items ordered (not the totals of each type of item), the total before the tax, the tax and the final total including the tax. Use a sentinel loop. • Use functions with value and reference parameters where appropriate. • Your numeric output must be formatted to show two places after the decimal even if the value after the decimal is 0. An output of 10 should display as 10.00.

Explanation / Answer

Python 2.7 code:

S = 0;
C = 0;
D = 0;
while(True):
   print " Menu"
   print " S = sandwiches - $3.00"
   print " C = chips - $1.50 "
   print " D = drink - $2.00 "
   print " X = cancel the sale and start over "
   print " T = total the sale."
   print " E = close the shift "
   inp = raw_input().strip()
   if(inp == "S"):
       S = S + 1
   elif(inp == "C"):
       C = C + 1
   elif(inp == "D"):
       D = D + 1
   elif(inp == "X"):
       S = 0;C = 0; D = 0;
   elif(inp == "T"):
       print "Sandwiches sold: ", S
       print "Chips sold: ", C
       print "Drinks sold: ", D
       total = S*3.0 + C*1.5 + D*2.0
       print "Total Before Tax =",total
       print "Tax= ", total*0.0825
       print "Total after Taxes", total + total*0.0825
   elif(inp == "E"):
       print "Taday's Sale= $", total
       break
   else:
       print "Invalid Input!"

Sample Output:

Menu
S = sandwiches - $3.00
C = chips - $1.50
D = drink - $2.00
X = cancel the sale and start over
T = total the sale.
E = close the shift
S
Menu
S = sandwiches - $3.00
C = chips - $1.50
D = drink - $2.00
X = cancel the sale and start over
T = total the sale.
E = close the shift
D
Menu
S = sandwiches - $3.00
C = chips - $1.50
D = drink - $2.00
X = cancel the sale and start over
T = total the sale.
E = close the shift
T
Sandwiches sold: 1
Chips sold: 0
Drinks sold: 1
Total Before Tax = 5.0
Tax= 0.4125
Total after Taxes 5.4125
Menu
S = sandwiches - $3.00
C = chips - $1.50
D = drink - $2.00
X = cancel the sale and start over
T = total the sale.
E = close the shift
E
Taday's Sale= $ 5.0

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote