public void Dispense()
 {
     _gumballMachine.ReleaseBall();
     if (_gumballMachine.Count > 0)
     {
         _gumballMachine.SetState(_gumballMachine.NoQuarterState);
     }
     else
     {
         Console.WriteLine("Opps, out of gumballs!");
         _gumballMachine.SetState(_gumballMachine.SoldOutState);
     }
 }
        public void Dispense()
        {
            _gumballMachine.ReleaseBall();
            if (_gumballMachine.Count > 0)
            {
                _gumballMachine.ReleaseBall();
                Console.WriteLine("YOU'RE A WINNER! You got two gumballs for your quarter");
            }

            if (_gumballMachine.Count > 0)
            {
                _gumballMachine.SetState(_gumballMachine.NoQuarterState);
            }
            else
            {
                _gumballMachine.SetState(_gumballMachine.SoldOutState);
            }
        }
 public void Refill()
 {
     _gumballMachine.SetState(_gumballMachine.NoQuarterState);
 }
 public void InsertQuarter()
 {
     Console.WriteLine("You inserted a quarter");
     _gumballMachine.SetState(_gumballMachine.HasQuarterState);
 }
Exemplo n.º 5
0
 public void EjectQuarter()
 {
     Console.WriteLine("Quarter returned");
     _gumballMachine.SetState(_gumballMachine.NoQuarterState);
 }