コード例 #1
0
        static void Main(string[] args)
        {
            var             input           = "";
            Display         display         = new Display();
            Keypad          keypad          = new Keypad();
            CashCollector   cashCollector   = new CashCollector(display, keypad);
            CardSlot        cardSlot        = new CardSlot(display, keypad);
            PaymentMethod   paymentMethod   = new PaymentMethod(cashCollector, cardSlot);
            Dispenser       dispenser       = new Dispenser();
            StockItemList   stockItemList   = new StockItemList();
            ChangeDispenser changeDispenser = new ChangeDispenser();
            BalanceSystem   balanceSystem   = new BalanceSystem();

            do
            {
                display.Greeting();
                input = keypad.TakeInput();
                paymentMethod.Choose(input, balanceSystem);
            } while (!(input == "card" || input == "cash"));

            display.DisplayStock();
            dispenser.DispenseStock(keypad.TakeStockItem(), stockItemList, cardSlot, keypad, changeDispenser, display, balanceSystem);
        }
コード例 #2
0
 public PaymentMethod(CashCollector cashCollector, CardSlot cardSlot)
 {
     _cashCollector = cashCollector;
     _cardSlot      = cardSlot;
 }