Exemple #1
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            GumballMachine gumballMachine = new GumballMachine("Aurora Park", 5);
            Console.WriteLine(gumballMachine.MachineStateHeader());

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

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

            Console.WriteLine(gumballMachine.MachineStateHeader());

            Console.WriteLine(gumballMachine.Refill(5));
            Console.WriteLine(gumballMachine.MachineStateHeader());

            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
Exemple #2
0
 public NoQuarterState(GumballMachine gumballMachine)
 {
     this.gumballMachine = gumballMachine;
     hasQuarterState = new HasQuarterState(gumballMachine);
 }
Exemple #3
0
 public SoldState(GumballMachine gumballMachine)
 {
     this.gumballMachine = gumballMachine;
     noQuarterState = new NoQuarterState(gumballMachine);
     soldOutState = new SoldOutState(gumballMachine);
 }
 public HasQuarterState(GumballMachine gumballMachine)
 {
     this.gumballMachine = gumballMachine;
 }
Exemple #5
0
 public GumballMonitor(GumballMachine machine)
 {
     this.machine = machine;
 }
Exemple #6
0
 public SoldOutState(GumballMachine gumballMachine)
 {
     this.gumballMachine = gumballMachine;
 }