Пример #1
0
 public VendingMachine()
 {
     MachineOutput.DisplayInstructions();
     MoneyInsertedState   = new MoneyInsertedState(this);
     NoMoneyInsertedState = new NoMoneyInsertedState(this);
     CurrentState         = new NoMoneyInsertedState(this);
 }
Пример #2
0
        public void SelectItem(string itemInput)
        {
            if (!ItemQueues.ContainsKey(itemInput))
            {
                return;
            }

            var itemQueue = ItemQueues[itemInput];

            if (itemQueue.IsInStock())
            {
                CurrentState.SelectItem(itemQueue);
            }
            else
            {
                MachineOutput.DisplaySoldOutError();
            }
        }
Пример #3
0
 //Intentionally left here for debugging/visibility. In an actual release this would not be present.
 public void Status()
 {
     MachineOutput.QueueStatus(_itemQueue.Peek().Name, _itemQueue.Peek().Flavor, _itemQueue.Peek().WrapperColor, (_itemQueue.Count - 1));
 }
Пример #4
0
 public void Report()
 {
     MachineOutput.ReportTrashStatus(Wrappers);
 }