public static void Main(string[] args)
    {
        ATMDispenseChain atmDispenser = new ATMDispenseChain();

        while (true)
        {
            int amount = 0;
            Console.WriteLine("Enter amount to dispense");
            amount = Convert.ToInt32(Console.ReadLine());
            if (amount % 10 != 0)
            {
                Console.WriteLine("Amount should be in multiple of 10s.");
                return;
            }
            // process the request
            atmDispenser.c1.dispense(new Currency(amount));
        }
    }
Пример #2
0
        static void ChainOfResponsibility()
        {
            ATMDispenseChain atmDispencer = new ATMDispenseChain();

            while (true)
            {
                Console.WriteLine("Enter amount");
                int input = Convert.ToInt32(Console.ReadLine());
                if (input % 10 != 0)
                {
                    Console.WriteLine("Amount should be in multiple of 10s.");
                    return;
                }
                atmDispencer.c1.dispence(new Currency()
                {
                    Amount = input
                });
            }
        }