public class GumballMachine extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) int |
count |
(package private) State |
hasQuarterState |
(package private) State |
noQuarterState |
(package private) State |
soldOutState |
(package private) State |
soldState |
(package private) State |
state |
Constructor and Description |
---|
GumballMachine(int numberGumballs) |
Modifier and Type | Method and Description |
---|---|
void |
ejectQuarter() |
(package private) int |
getCount() |
State |
getHasQuarterState() |
State |
getNoQuarterState() |
State |
getSoldOutState() |
State |
getSoldState() |
State |
getState() |
void |
insertQuarter() |
(package private) void |
refill(int count) |
(package private) void |
releaseBall() |
(package private) void |
setState(State state) |
java.lang.String |
toString() |
void |
turnCrank() |
State soldOutState
State noQuarterState
State hasQuarterState
int count
public GumballMachine(int numberGumballs)
public void insertQuarter()
public void ejectQuarter()
public void turnCrank()
void releaseBall()
int getCount()
void refill(int count)
public State getSoldOutState()
public State getNoQuarterState()
public State getHasQuarterState()
public State getSoldState()
public java.lang.String toString()
toString
in class java.lang.Object