Package com.ccprog3.coffeeTruck
Class SpecialCoffeeTruck
java.lang.Object
com.ccprog3.coffeeTruck.CoffeeTruck
com.ccprog3.coffeeTruck.SpecialCoffeeTruck
-
Field Summary
Fields inherited from class com.ccprog3.coffeeTruck.CoffeeTruck
storageBins
-
Constructor Summary
ConstructorsConstructorDescriptionSpecialCoffeeTruck
(String location, StorageBin[] storageBins, SpecialStorageBin[] specialStorageBins) 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 theStorageBin
ListmakeCoffee
(Coffee coffee, UserSingleton user) Checks and subtracts the required stocks to make theCoffee
void
setStorageBin
(StorageBin storageBin, int index) Sets a newIngredient
into aStorageBin
toString()
Methods inherited from class com.ccprog3.coffeeTruck.CoffeeTruck
getLocation, getSales, setLocation
-
Constructor Details
-
SpecialCoffeeTruck
public SpecialCoffeeTruck(String location, StorageBin[] storageBins, SpecialStorageBin[] specialStorageBins) throws NullPointerException, IndexOutOfBoundsException CoffeeTruck
constructor- Parameters:
location
-CoffeeTruck
locationstorageBins
- The Storage Bins to be placed in theCoffeeTruck
(Size 8)specialStorageBins
- The Special Storage Bins to be placed in the Coffee Truck (Size 2)- Throws:
NullPointerException
- Null in Special Storage BinsIndexOutOfBoundsException
- Special Storage Bins must be eight
-
-
Method Details
-
toString
- Overrides:
toString
in classCoffeeTruck
-
getStorageBins
Description copied from class:CoffeeTruck
Gets theStorageBin
List- Overrides:
getStorageBins
in classCoffeeTruck
- Returns:
StorageBin
List
-
setStorageBin
Description copied from class:CoffeeTruck
Sets a newIngredient
into aStorageBin
- Overrides:
setStorageBin
in classCoffeeTruck
- Parameters:
storageBin
- newStorageBin
to be replaced withindex
- Index of theStorageBin
to replace- Throws:
ArrayIndexOutOfBoundsException
- Index out of bounds
-
emptyStorageBin
Description copied from class:CoffeeTruck
Empties aStorageBin
- Overrides:
emptyStorageBin
in classCoffeeTruck
- 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 Description copied from class:CoffeeTruck
Checks and subtracts the required stocks to make theCoffee
- Overrides:
makeCoffee
in classCoffeeTruck
- Parameters:
coffee
- TheCoffee
to makeuser
- User to get prices- Returns:
- The generated
Coffee
sale - Throws:
ArithmeticException
- Not enough stock
-
calculatePrice
Description copied from class:CoffeeTruck
Calculates the price of theCoffee
- Overrides:
calculatePrice
in classCoffeeTruck
- Parameters:
coffee
- TheCoffee
to priceuser
- User to get prices- Returns:
- Price of the
Coffee
-