Exemple #1
0
        static void Main(string[] args)
        {
            try
            {
                var rubleBankomat = new Bancomat(new RubleHandlerChain.CreateChain());
                var result        = rubleBankomat.CashOut(2110);
                Console.WriteLine(result);  // [Banknote(Ruble, 1000), Bancknote(Ruble, 1000), Banknote(Ruble, 100), Banknote(Ruble, 10)]
                                            //  Выводим массив банкнот для последующей работы
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }


            try
            {
                var EuroBankomat = new Bancomat(new EuroHandlerChain.CreateChain());
                var result       = rubleBankomat.CashOut(123);
                Console.WriteLine(result);  // Ошибка
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);  // It is impossible to give out such an amount
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Bancomat bancomat = new Bancomat();

            bancomat.Validate("10 рублей");
            bancomat.CashOut("9032 рублей");
            bancomat.CashOut("90 рублей");
            bancomat.CashOut("9032$");
            bancomat.CashOut("9070$");

            Console.ReadKey();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            var bank = new Bancomat();
            var s    = bank.CashOut(253, "$");

            Console.ReadKey();
        }