Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will write a program that will allow a user to make a ( single ) selection from a list of options. This is very

You will write a program that will allow a user to make a (single) selection from a list of options. This is very common when writing programs and we will use it frequently throughout this class. Display the menu of selections to your user so that it looks like this:
Items available for purchase:
1. Chicken Wrap $4.50
2. Wings (10) $16.99
3. Fries $4.59
4. Meatball Sub $8.39
5. Soup $2.95
Enter the number corresponding to the item that you would like to purchase:
If the user enters a value outside of the range of values for your menu (that is, less than 1 or greater than 5), let them know that they have made an invalid choice and stop (use the if/elif/else statement logic to stop the program you may not use quit() or exit()). If the user enters a valid number (1-5), show them the price of the item they have chosen and ask them if they would like to add a tip. If yes, ask if they want to enter a percentage to indicate the tip amount or if they would like to add a set amount for the tip. (For instance, they may enter 18 for the tip (meaning 18%) or some dollar amount (eg.2.00) for a set amount tip).
Note that the user should just enter numbers, not "%" or "$" signs and you can assume that they do!
If they add a tip, add this to their order amount.
If they do not want to enter a tip, simply continue to the tax.
Tax on all items is 5%. We will calculate the tax after adding the tip.
Calculate the total amount they owe, including the price of the item purchased, the tax and the tip. So, for instance if the user chooses 3(Fries) and wants to leave a 10% tip, the total will be 4.59+(4.59*.10)=5.445*1.05=5.72.
In the end, inform the user of the grand total. Be sure to format the total to 2 decimal places. (There may be some rounding error, don't worry about that).
Don't forget your program header and comments!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

What do you know of my (the interviewers) research program?

Answered: 1 week ago