Package com.ccprog3.coffeeTruck
Class CoffeeTruck
java.lang.Object
com.ccprog3.coffeeTruck.CoffeeTruck
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SpecialCoffeeTruck
Coffee Truck class
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCoffeeTruck
(String location, StorageBin[] storageBins) CoffeeTruck
constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected Money
calculatePrice
(Coffee coffee, UserSingleton user) Calculates the price of theCoffee
void
emptyStorageBin
(int index) Empties aStorageBin
Gets the Truck locationgetSales()
Gets theCoffeeTruck
salesGets theStorageBin
ListmakeCoffee
(Coffee coffee, UserSingleton user) Checks and subtracts the required stocks to make theCoffee
void
setLocation
(String location) Sets the Truck locationvoid
setStorageBin
(StorageBin storageBin, int index) Sets a newIngredient
into aStorageBin
toString()
-
Field Details
-
storageBins
Storage Bins to store Ingredients
-
-
Constructor Details
-
CoffeeTruck
public CoffeeTruck(String location, StorageBin[] storageBins) throws NullPointerException, IndexOutOfBoundsException CoffeeTruck
constructor- Parameters:
location
-CoffeeTruck
locationstorageBins
- The Storage Bins to be placed in theCoffeeTruck
(Size 8)- Throws:
NullPointerException
- Null in Storage BinsIndexOutOfBoundsException
- Storage Bins must be eight
-
-
Method Details
-
toString
-
getLocation
-
getStorageBins
-
getSales
-
setLocation
Sets the Truck location- Parameters:
location
- Truck location
-
setStorageBin
Sets a newIngredient
into aStorageBin
- Parameters:
storageBin
- newStorageBin
to be replaced withindex
- Index of theStorageBin
to replace- Throws:
ArrayIndexOutOfBoundsException
- Index out of bounds
-
emptyStorageBin
Empties aStorageBin
- Parameters:
index
- Index of theStorageBin
to empty- Throws:
ArrayIndexOutOfBoundsException
- Index out of bounds
-
makeCoffee
public Map.Entry<Coffee,Money> makeCoffee(Coffee coffee, UserSingleton user) throws ArithmeticException Checks and subtracts the required stocks to make theCoffee
- Parameters:
coffee
- TheCoffee
to makeuser
- User to get prices- Returns:
- The generated
Coffee
sale - Throws:
ArithmeticException
- Not enough stock
-
calculatePrice
Calculates the price of theCoffee
- Parameters:
coffee
- TheCoffee
to priceuser
- User to get prices- Returns:
- Price of the
Coffee
-