Question
Babette's Bistro is a restaurant which sells delicious French bistro fare, although with a very limited selection. The menu consists of the following items with
Babette's Bistro is a restaurant which sells delicious French bistro fare, although with a very limited selection. The menu consists of the following items with associated prices:
Braised Rabbit $8.89 Crispy Duck $7.99 Grilled Steak $10.57
Write a Java program which displays a menu to the customer which allows them to place an order consisting of one or more items. The menu should use a simple numeric selection method to order an item. For example, '1' orders braised rabbit, '2' orders crispy duck, and '3' orders grilled steak, while '0' indicates the order is complete. To order more than one of an item, the customer selects the item again on the menu. Once a customer's order is complete, your program should display the total number of each item ordered and the total price overall for their order.
Your program must use a do-while loop to allow the customer to order multiple items (and complete their order by selecting 0), and it must use a switch statement to handle each possible type of input, as well as displaying an error message if an incorrect choice is selected. Include break statements for each case in your switch (including the default case). User input should be read as an integer (not a String or char).
Remember to use consistent alignment and indentation, an identification header, and descriptive comments in your code (but don't overdo it). All user-facing output (i.e. prompts) must be spell-checked and proofread for correctness. Use named constants for menu options, product names, and prices as we did in the ungraded practice exercise.
Remember to use a do-while loop! 10 points will be deducted if you use a while loop or for loop instead.
Expected Output (user input is shown in red)
Welcome to Babette's Bistro! Please enter an item to order, or 0 to complete your order. Enter 1 to order braised rabbit for $8.89 Enter 2 to order crispy duck for $7.99 Enter 3 to order grilled steak for $10.57 Order: 1 You have ordered a total of 1 rabbits(s) Please enter an item to order, or 0 to complete your order. Enter 1 to order braised rabbit for $8.89 Enter 2 to order crispy duck for $7.99 Enter 3 to order grilled steak for $10.57 Order: 1 You have ordered a total of 2 rabbits(s) Please enter an item to order, or 0 to complete your order. Enter 1 to order braised rabbit for $8.89 Enter 2 to order crispy duck for $7.99 Enter 3 to order grilled steak for $10.57 Order: 2 You have ordered a total of 1 ducks(s) Please enter an item to order, or 0 to complete your order. Enter 1 to order braised rabbit for $8.89 Enter 2 to order crispy duck for $7.99 Enter 3 to order grilled steak for $10.57 Order: 3 You have ordered a total of 1 steaks(s) Please enter an item to order, or 0 to complete your order. Enter 1 to order braised rabbit for $8.89 Enter 2 to order crispy duck for $7.99 Enter 3 to order grilled steak for $10.57 Order: 0 0 You have ordered 2 order(s) of rabbit 1 order(s) of duck 1 order(s) of steak Your total cost is $36.34
Invalid Input Example:
Welcome to Babette's Bistro! Please enter an item to order, or 0 to complete your order. Enter 1 to order braised rabbit for $8.89 Enter 2 to order crispy duck for $7.99 Enter 3 to order grilled steak for $10.57 Order: 4 Please enter a valid choice between 0 and 3 Please enter an item to order, or 0 to complete your order. Enter 1 to order braised rabbit for $8.89 Enter 2 to order crispy duck for $7.99 Enter 3 to order grilled steak for $10.57 Order: 0 0 You have ordered 0 order(s) of rabbit 0 order(s) of duck 0 order(s) of steak Your total cost is $0.00
158131079902/09/202011:59pm
- File Upload
- Text Entry
- Office 365
- Studio
Upload a file, or choose a file you've already uploaded. | |
File: | remove empty attachment Add Another Fileremove empty attachment |
Click here to find a file you've already uploaded | |
CancelSubmit Assignment | |
Submitting... |
Copy and paste or type your submission right here. |
Keyboard ShortcutsHTML EditorRich Content Editor |
CancelSubmit Assignment |
Description
Long Description
CancelUpdate Criterion
Additional Comments:
CancelUpdate Comments
Additional Comments:
Rating Score
Rating max scoreto > pts
Rating Title
Rating Description
CancelUpdate Rating
Rubric
Can't change a rubric once you've started using it.
Find a Rubric
Title: Find Rubric
Title
You've already rated students with this rubric. Any major changes could affect their assessment results.
Title
Criteria Ratings Pts Edit criterion descriptionDelete criterion row This criterion is linked to a Learning OutcomeDescription of criterion view longer description Range threshold: 5 pts Edit ratingDelete rating 5to >0 pts Full Marks blank Edit ratingDelete rating 0to >0 pts No Marks blank_2 This area will be used by the assessor to leave comments related to this criterion. pts / 5 pts -- Edit criterion descriptionDelete criterion row This criterion is linked to a Learning OutcomeDescription of criterion view longer description Range threshold: 5 pts Edit ratingDelete rating 5to >0 pts Full Marks blank Edit ratingDelete rating 0to >0 pts No Marks blank_2 This area will be used by the assessor to leave comments related to this criterion. pts / 5 pts -- Total Points: 5 out of 5 I'll write free-form comments when assessing students Remove points from rubric Don't post Outcomes results to Learning Mastery Gradebook Use this rubric for assignment grading Hide score total for assessment results CancelCreate Rubric |
Previous
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