foodManagement
Class Restaurant

java.lang.Object
  extended by foodManagement.Restaurant

public class Restaurant
extends java.lang.Object

The Restaurant has a name (String), a menu (list of Entrees), an inventory (list of Food), and an amount of cash on hand, measured in pennies (int) This class facilitates orders being placed, deliveries being made to the inventory, and entrees being added to the menu.


Constructor Summary
Restaurant(java.lang.String nameIn, int startingCash)
          Standard constructor.
 
Method Summary
 void addEntree(Entree entreeToAdd)
          Adds an entree to the menu.
 boolean addShipmentToInventory(SortedListOfImmutables list)
          Adds the specified list of food items to the inventory.
 boolean checkIfInInventory(Entree entree)
          Checks if the Food items contained in the specified Entree are actually contained in the restaurant's inventory.
 int getCash()
          Getter for the current amount of cash on hand
 SortedListOfImmutables getInventory()
          Getter for the inventory.
 SortedListOfImmutables getMenu()
          Getter for the menu.
 java.lang.String getName()
          Getter for the name of the restaurant.
 boolean placeOrder(Entree entree)
          Removes the food items contained in the specified Entree from the inventory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Restaurant

public Restaurant(java.lang.String nameIn,
                  int startingCash)
Standard constructor. The menu and the inventory are both initialized as empty lists. The name and cash amount are set to match the paramters.

Parameters:
nameIn - name of the restaurant
startingCash - cash amount that the restaurant will have, measured in pennies
Method Detail

getName

public java.lang.String getName()
Getter for the name of the restaurant.

Returns:
reference to the name of the restaurant

getMenu

public SortedListOfImmutables getMenu()
Getter for the menu.

Returns:
a reference to a copy of the menu

addEntree

public void addEntree(Entree entreeToAdd)
Adds an entree to the menu.

Parameters:
entreeToAdd - reference to the entree to be added to the menu

getInventory

public SortedListOfImmutables getInventory()
Getter for the inventory.

Returns:
a reference to a copy of the inventory

getCash

public int getCash()
Getter for the current amount of cash on hand

Returns:
the current amount of cash, measured in pennies

checkIfInInventory

public boolean checkIfInInventory(Entree entree)
Checks if the Food items contained in the specified Entree are actually contained in the restaurant's inventory.

Parameters:
entree - Entree that we are checking against the inventory
Returns:
true if the list of Food items contained in the Entree are all present in the inventory, false otherwise.

addShipmentToInventory

public boolean addShipmentToInventory(SortedListOfImmutables list)
Adds the specified list of food items to the inventory. If the total wholesale cost of all of the food items combined exceeds the amount of cash on hand, then NONE of the food items are added to the inventory. If the amount of cash on hand is sufficient to pay for the shipment, then the amount of cash on hand is reduced by the wholesale cost of the shipment.

Parameters:
list - food items to be added to the inventory
Returns:
true if the food items are added; false if the food items are not added because their wholesale cost exceeds the current cash on hand

placeOrder

public boolean placeOrder(Entree entree)
Removes the food items contained in the specified Entree from the inventory. If the inventory does not contain all of the items required for this Entree, then NOTHING is removed from the inventory. If the inventory contains all of the required items, then the amount of cash on hand is INCREASED by the retail value of the Entree.

Parameters:
entree - Entree that has been ordered
Returns:
true if the food items are removed from the inventory; false if the food items were not removed because one or more required items were not contained in the inventory


Web Accessibility