Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment Assignment For this project, you get to design and write a Java program to keep track of various menu items. Your program will store,

Assignment Assignment
For this project, you get to design and write a Java program to keep track of various menu items. Your program will store, display and modify salads, sandwiches and (you guessed it) frozen yogurts. Present the user with the following menu options:
Actions:
Add a salad
Add a sandwich
Add a frozen yogurt
Display an item
Display all items
Add a topping to an item
Quit
If the user does not enter one of these options, then display:
Sorry, Note, user input is in bold face blue and underlined text is required for test cases.
Add 2 Yogurts
Welcome to the Menu
Actions:
Add a salad
Add a sandwic
Add a frozen yogurt
Display an item
Display all items
Add a topping to an item
Quit
Please choose from the above actions: 3
You entered: 3
Please enter the name of the frozen yogurt: Berry Delight
You entered: Berry Delight
Please enter the price for the Berry Delight: 4.5
You entered: 4.5
Please enter the base yogurt flavor for Berry Delight: vanilla
You entered: vanilla
Please enter the topping to add to Berry Delight: blueberries
You entered: blueberries
Would you like to add another topping to Berry Delight (yes/no)? yes
You entered yes
Please enter the additional topping flavor: blackberries
You entered: blackberries
Would you like to add another topping to Berry Delight (yes/no)? yes
You entered yes
Please enter the additional topping flavor: strawberries
You entered: strawberries
Would you like to add another topping to Berry Delight (yes/no)? no
You entered no
Actions:
Add a salad
Add a sandwich
Add a frozen yogur
Display an item
Display all items
Add a topping to an item
Quit
Please choose from the above actions: 5
You entered: 5
Displaying 1 item:
Frozen Yogurt : Berry Delight
Price ,$5.48
Yogurt : vanill
Topping : blueberries, blackberries, strawberries
Actions:
Add a salad
Add a sandwich
Add a frozen yogurt
Display an item Actions
Add a salad
Add a sandwich
Add a frozen yogurt
Display an item
Display all items
Add
For this project, you get to design and write a Java program to keep track of various menu items. Your program will store, display and modify salads, sandwiches and (you guessed it) frozen yogurts. Present the user with the following menu options:
Actions:
1) Add a salad
2) Add a sandwich
3) Add a frozen yogurt
4) Display an item
5) Display all items
6) Add a topping to an item
9) Quit
If the user does not enter one of these options, then display:
Sorry, is not a valid option.
Where is the user's input.
All menu items have the following:
Name (String)
Price (double)
Topping (StringBuilder or StringBuffer of comma separated values)
In addition to everything that a menu item has, a main dish (salad or sandwich) also has:
Side (String)
A salad also has:
Dressing (String)
A sandwich also has:
Bread type (String)
In additional to everything that a menu item has, a frozen yogurt also has:
Base yogurt flavor (String)
To display or add a topping to a menu item, have the user just request the name of the item. For this project, you can assume that all input will be of the right type. This means that whole numbers will be entered for menu actions, real numbers for prices and strings for everything else. For example, the user may request a menu item that does not exist or a menu action that does not exist. If the requested menu item is not in the list, then display:
Sorry, could not find in the list
Where is the user's input. When displaying all of the menu items, display them in the order that they were entered. Note, for adding a topping to a menu item, verify that that the specified item is in the list before requesting the topping.
For this project, you get to have at least a separate class for a salad, sandwich and frozen yogurt. Store each class in a separate file. Furthermore, they need to be organized into an inheritance hierarchy. You are welcome to have more classes if they make sense in the hierarchy. You can use an abstract class if you want to. Note, this project was designed to minimize changes to the code that was in your FrozenYogurt class from Project 3. You will need to submit each of these .java files to codePost and CougarVIEW so that they can be compiled with your other code.
Additionally, have a driver class named Menu. Store all of the menu item objects (i.e., the salad, sandwich and frozen yogurt objects) in a single ArrayList in this class. Create the ArrayList in the main() method of your Menu class. You are not allowed to explicitly use the Object class anywhere in your Menu class (meaning, you should not have "Object" anywhere in your code in Menu.java). Also, do not store String objects in the ArrayList. Lastly, do not use instanceof in any of your .java files.
Only ask for input in your Menu class. Only display output in your Menu class.
codePost does not support the package statement. If your IDE inserted, then please remove that line of code fromNote, user input is in bold face blue and underlined text is required for test cases.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions