public void Dispense() { _machina.ReleaseBall(); if (_machina.GetCount() > 0) { _machina.SetState(_machina.GetNoQuarterState()); } else { Console.WriteLine("Oops out of Gumballs"); _machina.SetState(_machina.GetSoldOutState()); } }
public void Dispense() { Console.WriteLine("You are a winner! You get two gumballs for your quarter"); _machina.ReleaseBall(); if (_machina.GetCount() == 0) { _machina.SetState(_machina.GetSoldOutState()); } else { _machina.ReleaseBall(); if (_machina.GetCount() > 0) { _machina.SetState(_machina.GetNoQuarterState()); } else { Console.WriteLine("OoOoOOoooooOps,out of gumballs"); _machina.SetState(_machina.GetSoldOutState()); } } }