Пример #1
0
        static void Main(string[] args)
        {
            Customer     customer1 = new Customer("samyu", "addr1", "1234566");
            BankAccount4 account1  = new BankAccount4("100001", customer1, 2000);

            account1.Deposit(2000);

            account1.WithDraw(2000);

            System.Console.WriteLine("The account1 customer is " + account1.Show());
            Customer     customer2 = new Customer("adi", "addr2", "1234566");
            BankAccount4 account2  = new BankAccount4("100002", customer2, 3000);

            account2.TransferTo(account1, 3000);
            System.Console.WriteLine("The account2 customer is " + account2.Show());

            account1.CreditInterest(account1.CalculateInterest());
            System.Console.WriteLine("The account1 customer in savings accountis " + account1.Show());

            CurrentAccounts currentAccount = new CurrentAccounts("100001", customer1, 2000);

            currentAccount.CreditInterest(currentAccount.CalculateInterest());
            System.Console.WriteLine("The account1 customer is " + currentAccount.Show());

            OverDrafts overDraft = new OverDrafts("100001", customer1, 2000);

            overDraft.WithDraw(2000);
            overDraft.WithDraw(2000);
            overDraft.WithDraw(2000);
            overDraft.WithDraw(2000);
            overDraft.CreditInterest(overDraft.CalculateInterest());
            System.Console.WriteLine("The account1 customer is " + overDraft.Show());
        }
Пример #2
0
        public double TotalInterestPaid()
        {
            double total_interest = 0;

            for (int i = 0; i < BankAccounts.Count; i++)
            {
                BankAccount4 bankAccount = (BankAccount4)BankAccounts[i];
                double       intr        = bankAccount.CalculateInterest();
                if (intr > 0)
                {
                    total_interest += intr;
                }
            }
            return(total_interest);
        }
Пример #3
0
        public double TotalInterestEarn()
        {
            double totalInterestEarned = 0;

            for (int i = 0; i < BankAccounts.Count; i++)
            {
                BankAccount4 bankAccount = (BankAccount4)BankAccounts[i];
                Console.WriteLine("TotalInterestEarn {0}", bankAccount);
                double intrEarned = bankAccount.CalculateInterest();
                if (intrEarned < 0)
                {
                    totalInterestEarned = totalInterestEarned + (-intrEarned);
                }
            }
            return(totalInterestEarned);
        }