|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectVendingMachine
public class VendingMachine
Represents the Controller and the Model of the Vending Machine program. Allows users and operators to complete transaction with a vending machine.
| Constructor Summary | |
|---|---|
VendingMachine()
Constructs a new VendingMachine object with a standard inventory and an empty bank |
|
| Method Summary | |
|---|---|
void |
addToNumCoinsTotal()
Adds the coins entered by a user to the bank of coins in this VendingMachine |
void |
decrementProductCount(int index)
Decrements the quantity of the Product at the given index by one |
java.lang.String |
dispenseProduct(int index)
Returns a String representation of the dispensed form of the Product at the given index of 'allProducts' |
Product[] |
getAllProducts()
Returns a copy of the data stored in this VendingMachine's 'allProducts' field |
void |
increaseProductQuantity(int index,
int toAdd)
Increases the quantity of a Product by a given amount |
void |
incrementNumCoinsEnteredByUser()
Increments the number of coins entered by a user by one |
boolean |
matchesOperatorPasscode(int attempt)
Returns true iff the given number matches the operator passcode |
java.lang.String |
removeAllCoins()
Returns a String stating a confirmation of the removal of all the coins in this VendingMachine's bank |
void |
resetAllCoinsToZero()
Resets this VendingMachine's bank of coins to zero |
void |
resetCoinsEnteredByUserToZero()
Resets the number of coins entered by user to zero |
void |
resetNumCoinsEnteredByCurrentUser()
Resets the number of coins entered by the current user to zero |
java.lang.String |
returnCoinsToUser()
Returns a String stating a confirmation that the user's coins have been returned |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public VendingMachine()
| Method Detail |
|---|
public Product[] getAllProducts()
public void decrementProductCount(int index)
index - the index of the Product in 'allProducts' to decrementpublic java.lang.String dispenseProduct(int index)
index - the index in 'allProducts' of the Product to dispense
public void incrementNumCoinsEnteredByUser()
public void resetNumCoinsEnteredByCurrentUser()
public void addToNumCoinsTotal()
public void increaseProductQuantity(int index,
int toAdd)
index - the index of 'allProducts' of the Product to add totoAdd - the amount to increase the Product's quantity bypublic java.lang.String removeAllCoins()
public void resetAllCoinsToZero()
public java.lang.String returnCoinsToUser()
public void resetCoinsEnteredByUserToZero()
public boolean matchesOperatorPasscode(int attempt)
attempt - the number to test for equality against the operator passcode
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||