Пример #1
0
 static void Main(string[] args)
 {
     Account[] accounts = new Account[] { new Deposit(new Individual("Ivanov"), 999m, 7.5m), new Mortgage(new Individual("Petrov"), 5000m, 8.3m),
     new Mortgage(new Company("Telerik"), 200000m,6.5m), new Loan(new Individual("Georgiev"), 200000m,6.5m)};
     foreach (var account in accounts)
     {
         Console.WriteLine(account.CalcAmount(10));
     }
     Console.WriteLine();
     accounts[0].MakeDeposit(500);
     Console.WriteLine(accounts[0].CalcAmount(10));
 }
Пример #2
0
        public static void Main(string[] args)
        {
            var bankAccounts = new Account[]
            {
                new Loan(new Company("Mtel"), 20000000, 4),
                new Deposite(new Individual("Pesho Tunkoto"), 25, 6),
                new Mortage(new Individual("Todor Gerov"), 400, 4),
                new Deposite(new Company("Apple"), 599999999, 4),
            };

            (bankAccounts[0] as Loan).DepositeMoney(77777);
            (bankAccounts[1] as Deposite).WithdrawMoney(50);

            foreach (var account in bankAccounts)
            {
                Console.WriteLine("{0} Interest: {1}%", account, account.CalculateInterest(8));
            }
        }