Question
***Please write code in c++*** CONCEPT: Methods are ideal for use in menu-driven programs. When the user selects an item from a menu, the program
***Please write code in c++***
CONCEPT: Methods are ideal for use in menu-driven programs. When the user selects an item from a menu, the program can call the appropriate method.
Write a menu-driven program for De Anza College Food Court. (You need to use Methods !)
- Display the food menu to a user (Just show the 5 options' names and prices - No need to show the Combos or the details!)
- Use numbers for the options and for example "6" to exit.
- Ask the user what he/she wants and how many of it. (Check the user inputs) AND use trim() function to trim your inputs(if needed)
- Keep asking the user until he/she chooses the exit option.
You should have two classes, the first one is a driver class and the second one is the order class and includes these methods:
- A method to display the menu => displayMenu()
- A method to get inputs => getInputs()
- A method to calculate the tax and the bill => calculate(.....)
- A method to print the bill => printBill(....)
- You can use quantity1,quantity2,quantity3,quantity4,quantity5 to save the quantities of the burgers and put them inside an array
- You can use a constant array variable for the prices like priceArray = [5.25,5.75,5.95,5.95,5.95]
Note: You can use your own code design and naming methods. Better designs will get better grades.
Note: It is a good design if your main method is short and you call other methods from the main method. It means, it is better to use different methods instead of putting all your code in the main method.
- Calculate the price.
- Ask the user whether he/she is a student or staff. There is no tax for students and a 9% tax for staff. Add the tax price to the total price.
Tax | Cupertino | 9.000% | Santa Clara |
- Display the bill to the user. The bill includes:
- The food items
- The quantities
- The cost of them
- The total before tax
- Tax amount
- Total price after tax
You can have your own design but you need to have a main method and get started from the main method.
The name of methods also up to your design but the names should show what the methods do.
- Only display 2 decimal points when displaying all the numbers.
- Put at least two outputs (results after you run your code) at the end of your code as a multi-line comment.
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