Answered step by step
Verified Expert Solution
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:
Chicken Wrap $
Wings $
Fries $
Meatball Sub $
Soup $
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 or greater than let them know that they have made an invalid choice and stop use the ifelifelse statement logic to stop the program you may not use quit or exit If the user enters a valid number 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 for the tip meaning or some dollar amount eg 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 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 Fries and wants to leave a tip, the total will be
In the end, inform the user of the grand total. Be sure to format the total to 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
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