Пример #1
0
        public void DepositInMyBank(decimal amount)
        {
            using IAccount account = new BabyAccount();
            account.Deposit(amount);
            account.Deposit(amount);
            Console.WriteLine($"You currently have: {account.GetBalance():C}");
            Random rnd = new Random();

            for (int i = 0; i < 20; i++)
            {
                account.Withdraw(rnd.Next(i % 15, 15));
            }
        }
Пример #2
0
        public void ComparePricesInMyBank()
        {
            List <IAccount> accounts = new List <IAccount>();
            Random          rnd      = new Random();

            for (int i = 0; i < 10; i++)
            {
                IAccount account = new BabyAccount();
                accounts.Add(account);
            }
            accounts.Sort();
            foreach (IAccount account in accounts)
            {
                Console.WriteLine($"Balance {account.GetBalance()}");
            }
        }