Package trial.gaurav.menu
Class Menu
java.lang.Object
trial.gaurav.menu.Menu
- Direct Known Subclasses:
CustomerMenu
The `Menu` class provides functionality to display a menu and interact with the user's choices.
It uses a linked list of `MenuItem` objects to store and display the menu items.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMenu()Constructs a new `Menu` object with an empty list of menu items and a new `Scanner` for user input. -
Method Summary
Modifier and TypeMethodDescriptionintCollects the user's choice from the console.voiddisplay()Displays the menu and handles user interaction.
-
Field Details
-
sc
-
Constructor Details
-
Menu
public Menu()Constructs a new `Menu` object with an empty list of menu items and a new `Scanner` for user input.
-
-
Method Details
-
display
public void display()Displays the menu and handles user interaction. The user is prompted to enter their choice, and the corresponding action is executed. -
collectUserChoice
public int collectUserChoice()Collects the user's choice from the console.- Returns:
- The user's choice as an integer.
-