Package Menu
Class MenuItem
java.lang.Object
Menu.MenuItem
- All Implemented Interfaces:
Cloneable
The MenuItem class represents the menu and contains the MenuItem constructor used to add items to the MenuData hashMap.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of the menuItem for backup.boolean
Returns the availability that was input by the user.getItem()
gets the item nameint
Returns the name of the item.double
getPrice()
Returns the numerical value that was input when the item was added.getType()
Returns the type of item.void
setAvailability
(boolean availability) Sets the availability of the menu item to the specified value.void
Sets the type of menu item to the specified value.void
setPrice
(double price) Sets the price of the menu item to the specified value.void
Sets the type of menu item to the specified value.toString()
Returns a string representation of the menu in the format: "item: [item] | type: [type] | price: [cost] | availability: [availability]"
-
Constructor Details
-
MenuItem
Constructs a new MenuItem object with the specified item, type, price, and availability.- Parameters:
item
- the item nametype
- the type of menu itemprice
- the numerical value representing the cost of the itemavailability
- the representation of if the item is available to order
-
-
Method Details
-
getItemNum
public int getItemNum()Returns the name of the item.- Returns:
- item name
-
getItem
gets the item name- Returns:
- the item name
-
setItem
Sets the type of menu item to the specified value.- Parameters:
item
- the new name of the item
-
getType
Returns the type of item.- Returns:
- type of item
-
setType
Sets the type of menu item to the specified value.- Parameters:
type
- the new type of item
-
getPrice
public double getPrice()Returns the numerical value that was input when the item was added.- Returns:
- the price of the menu item
-
setPrice
public void setPrice(double price) Sets the price of the menu item to the specified value.- Parameters:
price
- the numerical value entered by the user that represents the cost of the item to customer
-
getAvailability
public boolean getAvailability()Returns the availability that was input by the user.- Returns:
- true if the item is available, false if it is not
-
setAvailability
public void setAvailability(boolean availability) Sets the availability of the menu item to the specified value. -
clone
Returns a clone of the menuItem for backup.- Returns:
- a backup clone of the menuItem
-
toString
Returns a string representation of the menu in the format: "item: [item] | type: [type] | price: [cost] | availability: [availability]"
-