// Constructor
 public SoldState(GumballMachine gumballMachine)
 {
     this._gumballMachine = gumballMachine;
 }
        static void Main(string[] args)
        {
            GumballMachine gumballMachine = new GumballMachine(5);

            Console.WriteLine(gumballMachine);

            gumballMachine.InsertQuarter();
            gumballMachine.TurnCrank();
            Console.WriteLine(gumballMachine);

            gumballMachine.InsertQuarter();
            gumballMachine.TurnCrank();
            gumballMachine.InsertQuarter();
            gumballMachine.TurnCrank();

            Console.WriteLine(gumballMachine);

            // Wait for user
            Console.ReadKey();
        }
 // Constructor
 public NoQuarterState(GumballMachine gumballMachine)
 {
     this._gumballMachine = gumballMachine;
 }
Exemple #4
0
 // Constructor
 public SoldState(GumballMachine gumballMachine)
 {
     this._gumballMachine = gumballMachine;
 }
Exemple #5
0
 // Constructor
 public NoQuarterState(GumballMachine gumballMachine)
 {
     this._gumballMachine = gumballMachine;
 }
 // Constructor
 public SoldOutState(GumballMachine gumballMachine)
 {
     _gumballMachine = gumballMachine;
 }
Exemple #7
0
 // Constructor
 public HasQuarterState(GumballMachine gumballMachine)
 {
     _gumballMachine = gumballMachine;
 }