public void Dispense() { Console.WriteLine("A gumball comes rolling out the slot "); _gumballMachine.ReleaseBall(); if (_gumballMachine.Count.Equals(0)) { Console.WriteLine("Out of gumballs"); _gumballMachine.SetState(_gumballMachine.SoldOutState); } else { _gumballMachine.SetState(_gumballMachine.NoQuarterState); } }
public void Dispense() { Console.WriteLine("You're a winner! You get two gumballs for your quarter"); _gumballMachine.ReleaseBall(); _gumballMachine.ReleaseBall(); if (_gumballMachine.Count.Equals(0)) { Console.WriteLine("Out of gumballs"); _gumballMachine.SetState(_gumballMachine.SoldOutState); } else { _gumballMachine.SetState(_gumballMachine.NoQuarterState); } }
public void EjectQuarter() { Console.WriteLine("Quarter returned"); _gumballMachine.SetState(_gumballMachine.NoQuarterState); }
public void InsertQuarter() { Console.WriteLine("You inserted a quarter."); _gumballMachine.SetState(_gumballMachine.HasQuarterState); }