Answered step by step
Verified Expert Solution
Question
1 Approved Answer
as || , you will design a simple salad bar interface. The program will display a main menu to the user to begin. User
as || , you will design a simple salad bar interface. The program will display a main menu to the user to begin. User will choose from given options to order types of salad, calculate and display total cost and tax. The program will repeat taking user input until user hits exit option. Design your solution: 1. Main menu: Create a main user menu to display the main options to the user. User have the option to choose between 1 and 3. The program will display an error message if user option is not within the valid selection (less than 1 and greater than 3). Think about using a conditional structure to serve the user choice. Invalid option (for e.g. 4) can be handled with default else block (please see sample I/O for error message). A main menu is as follows and detailed of each option is provided below: 1. Order Salad 2..Checkout 3. Quit a. Order Salad: User can order three different types of salad base: veggie, seafood and protein-based. Like main menu any invalid option will display an error message. A sample menu is as follows along with price: Salad Menu 1. Vegetarian - $8.99 2. Seafood - $12.99 3. Protein - $10.99 b. Checkout: Option 2 'Checkout' in main menu will calculate the total cost along with the sales tax. To calculate the tax, you can multiply sales tax with total cost. For this program, you can assume VA sales tax 5.2%. c. Quit: Quit will simply exit the program once user hits '3'. You can display a message for this option. (See below sample 1/0) Sample I/O: (user input shown in black) Sample run-1 (no error) ***********Welcome to Salad Bar *********** 1. Order Salad 2. Checkout 3. Quit Select your option (1-4): 1 Salad Menu 1. Vegetarian - $8.99 2. Seafood - $12.99 3. Protein - $10.99 Enter your salad selection (1-3): 1 One veggie salad added to your cart. 1. Order Salad 2. Checkout 3. Quit Select your option (1-4): 1 Salad Menu 1. Vegetarian - $8.99 2. Seafood - $12.99 3. Protein - $10.99 Enter your salad selection (1-3): 3 One protein-based salad added to your cart. 1. Order Salad 2. Checkout 3. Quit Select your option (1-4): 2 Checking out... Your total before tax: 19.98 Total tax (5.2%): 1.03896 Your total after tax: 21.01896 **** Thanks for using Salad Bar *********** 1. Order Salad 2. Checkout 3. Quit Select your option (1-4): 3 Exiting the program. Sample run-2 (with error message shown in red) ***********Welcome to Salad Bar *********** 1. Order Salad 2. Checkout 3. Quit Select your option (1-4): 4 #Error message Invalid option. Returning to main menu. 1. Order Salad 2. Checkout 3. Quit Select your option (1-4): 1 Salad Menu 1. Vegetarian - $8.99 2. Seafood - $12.99 3. Protein - $10.99 Enter your salad selection (1-3): 4 #Error message Invalid option. Returning to main menu. 1. Order Salad 2. Checkout 3. Quit Select your option (1-4): 1 Salad Menu 1. Vegetarian - $8.99 2. Seafood - $12.99 3. Protein - $10.99 Enter your salad selection (1-3): 1 One veggie salad added to your cart. 1. Order Salad 2. Checkout 3. Quit Select your option (1-4): 2 Checking out... Your total before tax: 8.99 Total tax (5.2%): 0.46748000000000006 Your total after tax: 9.45748 ***** Thanks for using Salad Bar *********** 1. Order Salad 2. Checkout 3. Quit Select your option (1-4): 3 Exiting the program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Here is the Python code for the salad bar interface PYTHON def main Create a main menu print Welcome to Salad Bar print1 Order Salad print2 Checkout print3 Quit Get the users choice choice intinputSel...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