public void Dispense() { _gumballMachine.GumballMachineReleaseBall(); if (_gumballMachine.Count > 0) { _gumballMachine.State = _gumballMachine.GumballMachineNoQuarterState; } else { Console.WriteLine("Oops, out of gumballs!"); _gumballMachine.State = _gumballMachine.GumballMachineSoldOutState; } }
public void Dispense() { Console.WriteLine("YOU'RE A WINNER! You get two balls for you quarter"); _gumballMachine.GumballMachineReleaseBall(); if (_gumballMachine.Count == 0) { _gumballMachine.State = _gumballMachine.GumballMachineSoldOutState; } else { _gumballMachine.GumballMachineReleaseBall(); if (_gumballMachine.Count > 0) { _gumballMachine.State = _gumballMachine.GumballMachineNoQuarterState; } else { Console.WriteLine("Oops, out of gumballs!"); _gumballMachine.State = _gumballMachine.GumballMachineSoldOutState; } } }