public void Dispense() { Console.WriteLine("SS: Dispensing"); _gumballMachine.ReleaseBall(); if (_gumballMachine.Count > 0) { _gumballMachine.SetState(_gumballMachine.NoQuarterState); } else { _gumballMachine.SetState(_gumballMachine.SoldOutState); } }
public void Dispense() { Console.WriteLine("WS: WINNER!"); _gumballMachine.ReleaseBall(); if (_gumballMachine.Count == 0) { _gumballMachine.SetState(_gumballMachine.SoldOutState); } else { _gumballMachine.ReleaseBall(); if (_gumballMachine.Count == 0) { _gumballMachine.SetState(_gumballMachine.SoldOutState); } else { _gumballMachine.SetState(_gumballMachine.NoQuarterState); } } }
public void EjectQuarter() { Console.WriteLine("HQS: Quarter returned..."); _gumballMachine.SetState(_gumballMachine.NoQuarterState); }
public void InsertQuarter() { Console.WriteLine("NQS: Thank you for inserting a quarter!"); _gumballMachine.SetState(_gumballMachine.HasQuarterState); }