|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectGrocery
public class Grocery
Grocery class managing items sold at the grocery
Constructor Summary | |
---|---|
Grocery(double startCash)
Constructor for a Grocery object. |
Method Summary | |
---|---|
void |
carryItem(String itemName,
String unitName,
double buyPrice,
double sellPrice)
Include an item to be carried in the grocery. |
double |
getCashOnHand()
Returns cash on hand in the grocery. |
int |
getItemStock(String itemName)
Returns the stock level for the given item. |
String |
getUnitName(String itemName)
Returns the unit name for the given item. |
void |
printInventory()
Prints an inventory list for all items. |
void |
receiveShipment(String itemName,
int qty)
Receive a shipment for a particular item. |
void |
sellItem(String itemName,
int qty)
Sell some number of units for a particular item. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Grocery(double startCash)
startCash
- initial cash on handMethod Detail |
---|
public void carryItem(String itemName, String unitName, double buyPrice, double sellPrice)
itemName
- name of the item (e.g., "Bread")unitName
- unit name for the item (e.g., "loaves" )buyPrice
- buying price for the itemsellPrice
- selling price for the itempublic double getCashOnHand()
public int getItemStock(String itemName)
itemName
- name of the item
public String getUnitName(String itemName)
itemName
- name of the item
public void printInventory()
public void receiveShipment(String itemName, int qty)
itemName
- name of the itemqty
- number of units of the item in the shipmentpublic void sellItem(String itemName, int qty)
itemName
- name of the itemqty
- number of units of the item to be sold
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |