Ejemplo n.º 1
0
        public double TotalInterestPaid()
        {
            double totalInterest = 0;

            for (int i = 0; i < listOfBankAccount.Count; i++)
            {
                BankAccount_3 b    = (BankAccount_3)listOfBankAccount[i];
                double        intr = b.CalculateInterest();
                if (intr > 0)
                {
                    totalInterest += intr;
                }
            }
            return(totalInterest);
        }
Ejemplo n.º 2
0
        public double TotalInterestEarned()
        {
            double total = 0;

            for (int i = 0; i < listOfBankAccount.Count; i++)
            {
                BankAccount_3 a    = (BankAccount_3)listOfBankAccount[i];
                double        intr = a.CalculateInterest();
                if (intr < 0)
                {
                    total += (-intr);
                }
            }
            return(total);
        }
Ejemplo n.º 3
0
            public static void Main()
            {
                Customer cus1 = new Customer("Tan Ah Kow", "2 Rich Street",
                                             "P123123", 20);
                Customer cus2 = new Customer("Kim May Mee", "89 Gold Road",
                                             "P334412", 60);

                BankAccount_3 a1 = new BankAccount_3("S0000223", cus1, 2000);

                Console.WriteLine(a1.CalculateInterest());
                OverdraftAccount a2 = new OverdraftAccount("O1230124", cus1, 2000);

                Console.WriteLine(a2.CalculateInterest());
                CurrentAccount a3 = new CurrentAccount("C1230125", cus2, -1);

                Console.WriteLine(a3.CalculateInterest());
            }