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:

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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:


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
Please choose from the above actions: 3
You entered: 3
Please enter the name of the frozen yogurt: Blackberry Cheesecake
You entered: Blackberry Cheesecake
Please enter the price for the Blackberry Cheesecake: 5.5
You entered: 5.5
Please enter the base yogurt flavor for Blackberry Cheesecake: vanilla
You entered: vanilla
Please enter the topping to add to Blackberry Cheesecake: blackberries
You entered: blackberries
Would you like to add another topping to Blackberry Cheesecake (yes/no)? yes
You entered yes
Please enter the additional topping flavor: crackers
You entered: crackers
Would you like to add another topping to Blackberry Cheesecake (yes/no)? no
You entered no
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
Please choose from the above actions: 5
You entered: 5
Displaying 3 items:
Salad : Farm Cobb (with Bacon Ranch)
♂
+
Transcribed Image Text: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 Please choose from the above actions: 3 You entered: 3 Please enter the name of the frozen yogurt: Blackberry Cheesecake You entered: Blackberry Cheesecake Please enter the price for the Blackberry Cheesecake: 5.5 You entered: 5.5 Please enter the base yogurt flavor for Blackberry Cheesecake: vanilla You entered: vanilla Please enter the topping to add to Blackberry Cheesecake: blackberries You entered: blackberries Would you like to add another topping to Blackberry Cheesecake (yes/no)? yes You entered yes Please enter the additional topping flavor: crackers You entered: crackers Would you like to add another topping to Blackberry Cheesecake (yes/no)? no You entered no 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 Please choose from the above actions: 5 You entered: 5 Displaying 3 items: Salad : Farm Cobb (with Bacon Ranch) ♂ +
Add Three and List
Welcome to the Menu
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
Please choose from the above actions: 1
You entered: 1
Please enter the name of the salad: Farm Cobb
You entered: Farm Cobb
Please enter the price for the Farm Cobb: 7.12
You entered: 7.12
Please enter the name of the side: Crispy Bacon
You entered: Crispy Bacon
Please enter the dressing for the Farm Cobb: Bacon Ranch
You entered: Bacon Ranch
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
Please choose from the above actions: 2
You entered: 2
Please enter the name of the sandwich: Italian Meatball
You entered: Italian Meatball
Please enter the price for the Italian Meatball: 8.99
You entered: 8.991
위
+
Þ.
Transcribed Image Text:Add Three and List Welcome to the Menu 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 Please choose from the above actions: 1 You entered: 1 Please enter the name of the salad: Farm Cobb You entered: Farm Cobb Please enter the price for the Farm Cobb: 7.12 You entered: 7.12 Please enter the name of the side: Crispy Bacon You entered: Crispy Bacon Please enter the dressing for the Farm Cobb: Bacon Ranch You entered: Bacon Ranch 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 Please choose from the above actions: 2 You entered: 2 Please enter the name of the sandwich: Italian Meatball You entered: Italian Meatball Please enter the price for the Italian Meatball: 8.99 You entered: 8.991 위 + Þ.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 7 images

Blurred answer
Knowledge Booster
Adjacency Matrix
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education