Can you please help me with this, its in java. Thank you. Write classes in an inheritance hierarchy Implement a polymorphic method Create an ArrayList object Use ArrayList methods For this, please design and write a Java program to keep track of various menu items. Your program will store, display and modify salads, sandwiches and 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 listWhere 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. 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. Examples of output:
Can you please help me with this, its in java. Thank you.
- Write classes in an inheritance hierarchy
- Implement a polymorphic method
- Create an ArrayList object
- Use ArrayList methods
For this, please design and write a Java program to keep track of various menu items. Your program will store, display and modify salads, sandwiches and 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, <NUMBER> is not a valid option.Where <NUMBER> 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 <NAME> in the listWhere <NAME> 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.
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.
Examples of output:



Trending now
This is a popular solution!
Step by step
Solved in 6 steps with 7 images









