public void Dispense() { Console.WriteLine("YOU'RE A WINNER! You get 2 gumballs for your quarter"); _machine.ReleaseBall(); var gumballsCount = _machine.GetCount(); if (gumballsCount == 0) { _machine.SetState(_machine.GetSoldOutState()); } else { _machine.ReleaseBall(); gumballsCount = _machine.GetCount(); if (gumballsCount > 0) { _machine.SetState(_machine.GetNoQuarterState()); } else { Console.WriteLine("Oops, out of gumballs!"); _machine.SetState(_machine.GetSoldOutState()); } } }
public bool TurnCrank() { Console.WriteLine("Successfully turned crank!"); bool winner = new Random().Next(0, 9) == 0; _gumballMachine.SetState(winner ? _gumballMachine.WinnerState : _gumballMachine.SoldState); return(true); }
public void Dispense() { _gumballMachine.ReleaseBall(); if (_gumballMachine.Count > 0) { _gumballMachine.SetState(_gumballMachine.NoQuarterState); } else { _gumballMachine.SetState(_gumballMachine.SoldOutState); } }
public void Dispense() { gumballMachine.ReleaseBall(); if (gumballMachine.GetCount() > 0) { gumballMachine.SetState(gumballMachine.GetNoTokenState()); } else { Debug.Log("Opps! out of gumballs!"); gumballMachine.SetState(gumballMachine.GetSoldOutState()); } }
public void Dispense() { _gumballMachine.ReleaseBall(); if (_gumballMachine.Count > 0) { _gumballMachine.SetState(_gumballMachine.NoQuarterState); } else { Console.WriteLine("Oops, out of gumballs!"); _gumballMachine.SetState(_gumballMachine.SoldOutState); } }
public void Dispense() { _gumballMachine.ReleaseBall(); if (_gumballMachine.Count > 0) { _gumballMachine.SetState(_gumballMachine.NoQuarterState); } else { Console.WriteLine("It was last gumball, please ask administrator to add gumballs"); _gumballMachine.SetState(_gumballMachine.SoldOutState); } }
public void Dispense() { gumballMachine.ReleaseBall(); if (gumballMachine.GetCount() > 0) { gumballMachine.SetState(gumballMachine.GetNoQuarterState()); } else { System.Console.WriteLine("Oops, out of gumballs!"); gumballMachine.SetState(gumballMachine.GetSoldOutState()); } }
public void Dispense() { _gumballMachine.ReleaseBall(); if (_gumballMachine.GetCount() > 0) { _gumballMachine.SetState(_gumballMachine.GetNoQuarterState()); } else { Console.WriteLine("Out of gumballs"); _gumballMachine.SetState(_gumballMachine.GetSoldOutState()); } }
public void Dispense() { gumballMachine.ReleaseBall(); if (gumballMachine.GetCount() > 0) { gumballMachine.SetState(gumballMachine.GetNoQuarterState()); } else { view.DisplayMessage("Oops, out of gumballs."); gumballMachine.SetState(gumballMachine.GetSoldOutState()); } }
public void Dispense() { _machine.ReleaseBall(); var gumballsCount = _machine.GetCount(); if (gumballsCount > 0) { _machine.SetState(_machine.GetNoQuarterState()); } else { Console.WriteLine("Oops, out of gumballs!"); _machine.SetState(_machine.GetSoldOutState()); } }
public void Dispense() { _gumballMachine.ReleaseBall(); if (_gumballMachine.Count == 0) { _gumballMachine.SetState(_gumballMachine.SoldOutState); } else { _gumballMachine.ReleaseBall(); Console.WriteLine("You are winner! Got another gumball"); if (_gumballMachine.Count > 0) { _gumballMachine.SetState(_gumballMachine.NoQuarterState); } else { Console.WriteLine("Oops, out of gumballs"); _gumballMachine.SetState(_gumballMachine.SoldOutState); } } }
public override void Dispense() { GumballMachine.ReleaseBall(); if (GumballMachine.GetCount() > 0) { GumballMachine.SetState(GumballMachine.GetNoQuarterState()); } else { GumballMachine.SetState(GumballMachine.GetSoldOutState()); } }
public void Dispense() { gumballMachine.ReleaseBall(); if (gumballMachine.GetCount() == 0) { gumballMachine.SetState(gumballMachine.GetSoldOutState()); } else { gumballMachine.ReleaseBall(); System.Console.WriteLine("YOU’RE A WINNER! You got two gumballs for your quarter"); if (gumballMachine.GetCount() > 0) { gumballMachine.SetState(gumballMachine.GetNoQuarterState()); } else { System.Console.WriteLine("Oops, out of gumballs!"); gumballMachine.SetState(gumballMachine.GetSoldOutState()); } } }
public void Dispense() { Console.WriteLine("You are a WINNER! You get two gumballs for your quarter."); _gumballMachine.ReleaseBall(); if (_gumballMachine.Count > 0) { _gumballMachine.ReleaseBall(); if (_gumballMachine.Count > 0) { _gumballMachine.SetState(_gumballMachine.GetNoQuarterState()); } else { Console.WriteLine("Oops, out of gumballs!"); _gumballMachine.SetState(_gumballMachine.GetSoldOutState()); } } else { _gumballMachine.SetState(_gumballMachine.GetSoldOutState()); } }
public override void Dispense() { GumballMachine.ReleaseBall(); if (GumballMachine.Count > 0) { GumballMachine.SetState(GumballMachine.NoQuarterState); } else { "Oops, out of gumballs!".P(); GumballMachine.SetState(GumballMachine.SoldOutState); } }
public void Dispense() { _gumballMachine.ReleaseBall(); if (_gumballMachine.Count == 0) { _gumballMachine.SetState(_gumballMachine.SoldOutState); } else { _gumballMachine.ReleaseBall(); Console.WriteLine("YOU'RE A WINNER! You got two gumballs for your quarter"); if (_gumballMachine.Count > 0) { _gumballMachine.SetState(_gumballMachine.NoQuarterState); } else { Console.WriteLine("Oops, out of gumballs!"); _gumballMachine.SetState(_gumballMachine.SoldOutState); } } }
public void Dispense() { Console.WriteLine("You're a winner! You get 2 gumballs for your quarter"); _gumballMachine.ReleaseBall(); if (_gumballMachine.GetCount() == 0) { _gumballMachine.SetState(_gumballMachine.GetNoQuarterState()); } else { _gumballMachine.ReleaseBall(); if (_gumballMachine.GetCount() > 0) { _gumballMachine.SetState(_gumballMachine.GetNoQuarterState()); } else { Console.WriteLine("Out of gumballs"); _gumballMachine.SetState(_gumballMachine.GetSoldOutState()); } } }
public override void TurnCrank() { "You turned...".P(); int winner = _rand.Next(10); if (winner == 0 && GumballMachine.Count > 1) { GumballMachine.SetState(GumballMachine.WinnerState); } else { GumballMachine.SetState(GumballMachine.SoldState); } }
public void Dispense() { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("YOU ARE A WINNER!!! You get two gumballs for your quarter"); Console.ResetColor(); _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 override void TurnCrank() { Console.WriteLine("You turned..."); int winner = randomWinner.Next(10); if (winner == 0 && GumballMachine.GetCount() > 1) { GumballMachine.SetState(GumballMachine.GetWinnerState()); } else { GumballMachine.SetState(GumballMachine.GetSoldState()); } GumballMachine.SetState(GumballMachine.GetSoldState()); }
public override void Dispense() { "You're a winner! You get two gumballs for your quarter".P(); GumballMachine.ReleaseBall(); if (GumballMachine.Count == 0) { GumballMachine.SetState(GumballMachine.SoldOutState); } else { GumballMachine.ReleaseBall(); if (GumballMachine.Count > 0) { GumballMachine.SetState(GumballMachine.NoQuarterState); } else { "Oops, out of gumballs".P(); GumballMachine.SetState(GumballMachine.SoldOutState); } } }
public override void Dispense() { Console.WriteLine("YOU ARE A WINNER! You get two gumballs for youre 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 override void InsertQuarter() { Console.WriteLine("You inserted a quarter"); GumballMachine.SetState(GumballMachine.GetHasQuarterState()); }
public void EjectQuarter() { view.DisplayMessage("Quarter returned."); gumballMachine.SetState(gumballMachine.GetNoQuarterState()); }
public void InsertQuarter() { Console.WriteLine("You inserted a quarter"); _gumballMachine.SetState(_gumballMachine.HasQuarterState); }
public void InsertQuarter() { System.Console.WriteLine("You inserted a quarter"); gumballMachine.SetState(gumballMachine.GetHasQuarterState()); }
public void InsertQuarter() { view.DisplayMessage("You inserted a quarter."); gumballMachine.SetState(gumballMachine.GetHasQuarterState()); }
public override void AddGumballs(int count) { base.AddGumballs(count); GumballMachine.SetState(GumballMachine.NoQuarterState); }
public void EjectQuarter() { Console.WriteLine("Quarter returned"); _machine.SetState(_machine.GetNoQuarterState()); }
public void EjectQuarter() { Console.WriteLine("Quarter returned"); _gumballMachine.SetState(_gumballMachine.NoQuarterState); }