Пример #1
0
        static void Main(string[] args)
        {
            Account[] accounts =
            {
                new LoanAccount(CustomerType.Company, 4329.43m, 0.33m,  10),
                new LoanAccount(CustomerType.Individual, 4329.43m, 0.33m, 10),

                new DepositAccount(CustomerType.Company, 1000m, 0.13m, 8),
                new DepositAccount(CustomerType.Individual, 1000m, 0.13m, 8),

                new MortgageAccount(CustomerType.Company, 5000.34m, 0.68m, 3),
                new MortgageAccount(CustomerType.Individual, 5000.34m, 0.68m, 3)
            };

            DepositAccount depositAccount = new DepositAccount(CustomerType.Company, 4324.5m, 0.1m, 3);

            depositAccount.Deposit(3000m);
            depositAccount.WithDraw(5000m);
            Console.WriteLine(depositAccount.Balance);

            foreach(var account in accounts)
            {
                Console.WriteLine(account.CalculateInterest());
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Account[] accounts =
            {
                new LoanAccount(CustomerType.Company,        4329.43m, 0.33m, 10),
                new LoanAccount(CustomerType.Individual,     4329.43m, 0.33m, 10),

                new DepositAccount(CustomerType.Company,        1000m, 0.13m,  8),
                new DepositAccount(CustomerType.Individual,     1000m, 0.13m,  8),

                new MortgageAccount(CustomerType.Company,    5000.34m, 0.68m,  3),
                new MortgageAccount(CustomerType.Individual, 5000.34m, 0.68m, 3)
            };

            DepositAccount depositAccount = new DepositAccount(CustomerType.Company, 4324.5m, 0.1m, 3);

            depositAccount.Deposit(3000m);
            depositAccount.WithDraw(5000m);
            Console.WriteLine(depositAccount.Balance);


            foreach (var account in accounts)
            {
                Console.WriteLine(account.CalculateInterest());
            }
        }
        static void Main(string[] args)
        {
            // Deposit account testing
            DepositAccount georgi = new DepositAccount(Customer.individual, 500, 3);
            georgi.Deposit(300);
            Console.WriteLine("Georgi`s balance is: {0}", georgi.Balance);
            georgi.Withdraw(200);
            Console.WriteLine("Georgi`s balance after withdraw is: {0}", georgi.Balance);
            Console.WriteLine("Georgi has interest {0:0.00}" , georgi.CalculateInterest(10));

            // Loan account testing
            LoanAccount blizzard = new LoanAccount(Customer.company, 1000000, 5);
            blizzard.Deposit(5000000);
            Console.WriteLine("\nBlizzard`s balance is: {0}", blizzard.Balance);
            Console.WriteLine("Blizzard has interest {0:0.00}", blizzard.CalculateInterest(10));

            // Mortgage account testing
            MortgageAccount misho = new MortgageAccount(Customer.individual, 10000, 7);
            misho.Deposit(500);
            Console.WriteLine("\nMisho`s balance is: {0}", misho.Balance);
            Console.WriteLine("Misho has interest {0:0.00}", misho.CalculateInterest(10));
        }