Question

Design your solution: 1. Main menu: Create a main user menu to display the main options to the user. User have the option toProgramming Language is Python

Need it to look just like the sample output. pls and ty!!Sample 1/0: (user input shown in black) Sample run - 1 (no error) ***********Welcome to Simple Takeout******* Sample run-2 (w

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The above question can be solved in the following steps-

STEP 1- Display the opening message and run an infinite while loop that breaks when user enters 4 to quit.

STEP 2- Display the main option menu. If user chooses to order pizza, ask for pizza selection and compute the cost and add it to totalBeforeTax.

STEP 3- If user chooses to order drinks, ask for drink selection and compute the cost and add it to totalBeforeTax.

STEP 4- If user chooses to checkout, display the totalBeforeTax, and then compute and show the totalAfterTax.

STEP 5- If user enters to quit, break the while loop. Also add necessary invalid option messages at right places.

PYTHON CODE-

#opening message for user
print("\t********************WELCOME TO SIMPLE TAKEOUT************************")
#stores the total amount before tax
totalBeforeTax = 0.0
#stores the total amount after tax
totalAfterTax = 0.0
#an infinite while loop that breaks when user enters 4 to Quit
while(True):
#display the options
print("\t1.Order Pizza\n\t2.Order Drinks\n\t3.Checkout\n\t4.Quit")
#store the user input for option
option = int(input("Select your option(1-4) : "))
#if user chooses to order pizza
if option == 1:
#display pizza menu
print("\tPizza Menu")
print("\t1.Cheese Lovers- $11.99\n\t2.Meat Lovers- $14.99\n\t3.Veggie Lovers- $12.99")
#ask user for pizza selection
pizzaSelection = int(input("Enter your pizza selection(1-3) : "))
#if pizzaSelection is cheese pizza,
if pizzaSelection == 1:
#ask user for number of cheese pizza and compute the cost and add it to totalBeforeTax
countPizza = int(input("How many cheese pizza? "))
totalBeforeTax += (countPizza*11.99)
#if pizzaSelection is meat pizza
elif pizzaSelection == 2:
#take user input for no of meat pizza and compute the cost and add to totalBeforeTax
countPizza = int(input("How many meat pizza? "))
totalBeforeTax += (countPizza*14.99)
#if pizzaSelection is veggie pizza,   
elif pizzaSelection == 3:
#ask for number of veggie pizza, compute and add it to totalBeforeTax
countPizza = int(input("How many veggie pizza? "))
totalBeforeTax += (countPizza*12.99)
#Invalid option
else:
print("Invalid option. Returning to main menu")
continue
#if user chooses to order Drinks
elif option == 2:
#display drinks menu
print("\tDrinks Menu")
print("\t1.Soda- $1.50\n\t2.Water Bottle- $1.00")
#user input for drinkSelection
drinkSelection = int(input("Enter your drink selection(1-2) : "))
#user selects soda
if drinkSelection == 1:
#store the count, compute and add cost to totalBeforeTax
countDrink = int(input("How many soda ? "))
totalBeforeTax += (countDrink*1.50)
#if user wants water bottles
elif drinkSelection == 2:
#store the count, compute cost and add to totalBeforeTax
countDrink = int(input("How many water bottles ? "))
totalBeforeTax += (countDrink*1.00)
#Invalid option
else:
print("Invalid option. Returning to main menu")
continue
#if user chooses to Checkout
elif option == 3:
print("\tChecking out...")
#display the totalBeforeTax
print("\tYour total before tax : ",totalBeforeTax)
#compute the totalAfterTax with tax rate at 4.3% or 0.043
totalAfterTax = totalBeforeTax + (totalBeforeTax * 0.043)
#display the totalAfterTax
print("\tYour total after tax : ",totalAfterTax)
print("\t*******************Thanks for using the Simple Takeout***************")
#re-initialize the totalBeforeTax and totalAfterTax
totalBeforeTax = 0.0
totalAfterTax = 0.0
#if user chooses to exit
elif option == 4:
print("Exiting the program")
break
#Invalid Option
else:
print("Invalid Option")
  

IMAGE OF CODE-

5 10 14 - 15 #opening message for user 2 print(\t********************WELCOME TO SIMPLE TAKEOUT************************ #stor

36 38 0 40 - 46 47 - 52- #Invalid option else: print(Invalid option. Returning to main menu) continue #if user chooses to o

za 75 76 #re-initialize the totalBefore Tax and totalAfter Tax totalBefore Tax = 0.0 totalAfterTax = 0.0 #if user chooses to

OUTPUT-

CASE#1*****WELCOME TO SIMPLE TAKEOUT** 1. Order Pizza 2.Order Drinks 3.Checkout 4.Quit Select your option (1-4) : 1 Pizza Menu 1. C

Enter your drink selection (1-2) : 2 How many water bottles ? 1 1.Order Pizza 2.Order Drinks 3.Checkout 4.Quit Select your op

CASE#2ttttttttttttttttttt*WELCOME TO SIMPLE TAKEOTIT******tttttttttttttttttt 1.Order Pizza 2.Order Drinks 3.Checkout 4.Quit Select

If this answer helps, please give an up vote and feel free to comment for any query.

Add a comment
Know the answer?
Add Answer to:
Programming Language is Python Need it to look just like the sample output. pls and ty!!...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ programming For this assignment, write a program that will act as a geometry calculator. The...

    C++ programming For this assignment, write a program that will act as a geometry calculator. The program will be menu-driven and should continue to execute as long as the user wants to continue. Basic Program Logic The program should start by displaying a menu similar to the following: Geometry Calculator 1. Calculate the area of a circle 2. Calculate the area of a triangle 3. Quit Enter your choice(1-3): and get the user's choice as an integer. After the choice...

  • Need help writing this code in python. This what I have so far. def display_menu(): print("======================================================================")...

    Need help writing this code in python. This what I have so far. def display_menu(): print("======================================================================") print(" Baseball Team Manager") print("MENU OPTIONS") print("1 - Calculate batting average") print("2 - Exit program") print("=====================================================================")    def convert_bat(): option = int(input("Menu option: ")) while option!=2: if option ==1: print("Calculate batting average...") num_at_bats = int(input("Enter official number of at bats: ")) num_hits = int(input("Enter number of hits: ")) average = num_hits/num_at_bats print("batting average: ", average) elif option !=1 and option !=2: print("Not a valid...

  • I really need help with this python programming assignment asap please double check indentations, thank you...

    I really need help with this python programming assignment asap please double check indentations, thank you We were unable to transcribe this imageEnter a drink option: Milk 22 Guest #1: a Please select the number of your entree choice 1) Planked salmon, 2) Prime rib, 3) Sesame tofu with spinach: 3 Please select the number of your dessert choice 27 1) Caramel oat bar, 2) Chocolate decadence, 3) Orange creme brulee: 1 Please select the number of your drink choice...

  • Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anythi...

    Python 3.7 to be used. Just a simple design a program that depends on its own. You should also not need to import anything. No code outside of a function! Median List Traversal and Exception Handling Create a menu-driven program that will accept a collection of non-negative integers from the keyboard, calculate the mean and median values and display those values on the screen. Your menu should have 6 options 50% below 50% above Add a number to the list/array...

  • Write the Script in Python. courseCategories = ["Mathematics","Computer Science","Business","Economics","Literature","Art","Music"] Sample of the output. It should look...

    Write the Script in Python. courseCategories = ["Mathematics","Computer Science","Business","Economics","Literature","Art","Music"] Sample of the output. It should look same as the output. 'SR' - Sort a. b. 1. This operation will display the list before being sorted Display the list to the user after being sorted 2. 'CC-Character Count This operation will prompt the user for an index as an integer that will be the location to reference in the list If the integer is less than 0 or greater than the...

  • 23.4 Project 4: Using Pandas for data analysis and practice with error handling Python Please! 23.4...

    23.4 Project 4: Using Pandas for data analysis and practice with error handling Python Please! 23.4 PROJECT 4: Using Pandas for data analysis and practice with error handling Overview In this project, you will use the Pandas module to analyze some data about some 20th century car models, country of origin, miles per gallon, model year, etc. Provided Input Files An input file with nearly 200 rows of data about automobiles. The input file has the following format (the same...

  • The purpose of this assignment is to get experience with an array, do while loop and...

    The purpose of this assignment is to get experience with an array, do while loop and read and write file operations. Your goal is to create a program that reads the exam.txt file with 10 scores. After that, the user can select from a 4 choice menu that handles the user’s choices as described in the details below. The program should display the menu until the user selects the menu option quit. The project requirements: It is an important part...

  • Python please For this program, we will be making lists for the local Zoo. You have...

    Python please For this program, we will be making lists for the local Zoo. You have been provided with 4 lists of data already created for you. Using this data, we update the data at this Zoo. YOU MUST USE LIST FUNCTIONS FOR REMOVING TO RECEIVE YOUR FULL POINTS! Input: A type of animal -- This information should be provided in response the question: "What animal are we removing?" A number corresponding to the selection of a menu number (see...

  • 1- TigerOne Bank is a local bank that intends to install a new automated teller machine...

    1- TigerOne Bank is a local bank that intends to install a new automated teller machine (ATM) to allow its customers to perform basic financial transactions. Using the ATM machine users should be able to view their account balance, withdraw cash and deposit funds. The bank wants you to develop the software application that will be installed on the new ATM machines. The following are the requirements for the application:  Users are uniquely identified by an account number and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT