Esempio n. 1
0
 public void Dispense()
 {
     Console.WriteLine("YOU'RE A WINNER! You get two gumballs for your quarter");
     _machine.ReleaseBall();
     if (_machine.Count == 0)
     {
         _machine.State = _machine.GetSoldOutState();
     }
     else
     {
         _machine.ReleaseBall();
         if (_machine.Count > 0)
         {
             _machine.State = _machine.GetNoQuarterState();
         }
         else
         {
             Console.WriteLine("Oops, out of gumballs!");
             _machine.State = _machine.GetSoldOutState();
         }
     }
 }
 public void Dispense()
 {
     _machine.ReleaseBall();
     if (_machine.Count > 0)
     {
         _machine.State = _machine.GetNoQuarterState();
     }
     else
     {
         Console.WriteLine("Oops, out of gumballs!");
         _machine.State = _machine.GetSoldOutState();
     }
 }