Beispiel #1
0
 public override void Dispense()
 {
     gummballDispenser.ReleaseBall();
     if (gummballDispenser.Count > 0)
     {
         gummballDispenser.SetState(gummballDispenser.NoQuarterState);
     }
     else
     {
         Console.WriteLine("Oops, out of gumballs!");
         gummballDispenser.SetState(gummballDispenser.SoldOutState);
     }
 }
Beispiel #2
0
 public override void InsertQuarter()
 {
     Console.WriteLine("You inserted a quarter");
     gummballDispenser.SetState(gummballDispenser.HasQuarterState);
 }
Beispiel #3
0
 public override void EjectQuarter()
 {
     Console.WriteLine("Quarter returned");
     gummballDispenser.SetState(gummballDispenser.NoQuarterState);
 }