public void Dispense() { _gumbalMachineContext.ReleaseBall(); if (_gumbalMachineContext.BallsCount == 0) { Console.WriteLine("Oops, out of gumbals"); _gumbalMachineContext.SetSoldOutState(); } else if (_gumbalMachineContext.QuartersCount == 0) { _gumbalMachineContext.SetNoQuarterState(); } else { _gumbalMachineContext.SetHasQuarterState(); } }
public void InsertQuarter() { Console.WriteLine("You inserted a quarter"); ++_gumbalMachineContext.QuartersCount; _gumbalMachineContext.SetHasQuarterState(); }