public void Dispense()
 {
     gumballMachine.ReleaseBall();
     if (gumballMachine.GetCount() > 0)
     {
         gumballMachine.SetState(gumballMachine.GetNoQuarterState());
     }
     else
     {
         Console.WriteLine("Oops, out of gumballs!");
         gumballMachine.SetState(gumballMachine.GetSoldOutState());
     }
 }
 public void Dispense()
 {
     Console.WriteLine("YOU'RE A WINNER! You get two balls for your quarter");
     gumballMachine.ReleaseBall();
     if (gumballMachine.GetCount() == 0)
     {
         gumballMachine.SetState(gumballMachine.GetSoldOutState());
     }
     else
     {
         gumballMachine.ReleaseBall();
         if (gumballMachine.GetCount() > 0)
         {
             gumballMachine.SetState(gumballMachine.GetNoQuarterState());
         }
         else
         {
             Console.WriteLine("Oops, out of gumballs!");
             gumballMachine.SetState(gumballMachine.GetSoldOutState());
         }
     }
 }
        public void TurnCrank()
        {
            Console.WriteLine("You turned...");
            var winner = random.Next(0, 10);

            if (winner == 0 && gumballMachine.GetCount() > 1)
            {
                gumballMachine.SetState(gumballMachine.GetWinnerState());
            }
            else
            {
                gumballMachine.SetState(gumballMachine.GetSoldState());
            }
        }