Package Menu

Class MenuItem

java.lang.Object
Menu.MenuItem
All Implemented Interfaces:
Cloneable

public class MenuItem extends Object implements Cloneable
The MenuItem class represents the menu and contains the MenuItem constructor used to add items to the MenuData hashMap.
  • Constructor Summary

    Constructors
    Constructor
    Description
    MenuItem(int number, String item, String type, double price, boolean availability)
    Constructs a new MenuItem object with the specified item, type, price, and availability.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a clone of the menuItem for backup.
    boolean
    Returns the availability that was input by the user.
    gets the item name
    int
    Returns the name of the item.
    double
    Returns the numerical value that was input when the item was added.
    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.
    Returns a string representation of the menu in the format: "item: [item] | type: [type] | price: [cost] | availability: [availability]"

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MenuItem

      public MenuItem(int number, String item, String type, double price, boolean availability)
      Constructs a new MenuItem object with the specified item, type, price, and availability.
      Parameters:
      item - the item name
      type - the type of menu item
      price - the numerical value representing the cost of the item
      availability - 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

      public String getItem()
      gets the item name
      Returns:
      the item name
    • setItem

      public void setItem(String item)
      Sets the type of menu item to the specified value.
      Parameters:
      item - the new name of the item
    • getType

      public String getType()
      Returns the type of item.
      Returns:
      type of item
    • setType

      public void setType(String type)
      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

      public Object clone()
      Returns a clone of the menuItem for backup.
      Returns:
      a backup clone of the menuItem
    • toString

      public String toString()
      Returns a string representation of the menu in the format: "item: [item] | type: [type] | price: [cost] | availability: [availability]"
      Overrides:
      toString in class Object
      Returns:
      a string representation of the menu