Example #1
0
        public double TotalDeposits()
        {
            double total = 0;

            for (int i = 0; i < BankAccounts.Count; i++)
            {
                BankAccount3 a   = (BankAccount3)BankAccounts[i];
                double       bal = a.Balance;
                if (bal > 0)
                {
                    total += bal;
                }
            }
            return(total);
        }
Example #2
0
        public double TotalInterestEarned()
        {
            double total = 0;

            for (int i = 0; i < BankAccounts.Count; i++)
            {
                BankAccount3 a    = (BankAccount3)BankAccounts[i];
                double       intr = a.CalculateInterest();
                if (intr < 0)
                {
                    total += (-intr);
                }
            }
            return(total);
        }
Example #3
0
        public void PrintCustomers()
        {
            List <Customer> customerList = new List <Customer>();

            for (int i = 0; i < BankAccounts.Count; i++)
            {
                BankAccount3 a = BankAccounts[i];
                Customer     c = a.AccountHolderName;
                //int c = cust.IndexOf(t);
                //if (c < 0)
                customerList.Add(c);
            }
            foreach (Customer c in customerList)
            {
                Console.WriteLine(c);
            }
        }
Example #4
0
        public void TransferTo(double amount, BankAccount3 another)
        {
            this.Withdraw(amount);
            another.Deposit(amount);

            /*
             * if (amount > balance)
             * {
             *  Console.WriteLine("Cannot transfer the amount greater than balance");
             * }
             * else
             * {
             *  balance = balance - amount;
             *  another.Deposit(amount);
             *  Console.WriteLine("Transfer ${0} dollars to {1}'account:{2}", amount, another.AccountHolderName, another.AccountNumber);
             * }
             */
        }
Example #5
0
 public void AddAccount(BankAccount3 b)
 {
     BankAccounts.Add(b);
 }
Example #6
0
 public new void TransferTo(double amount, BankAccount3 another)
 {
     balance = balance - amount;
     another.Deposit(amount);
     Console.WriteLine("Transfer ${0} dollars to {1}'account:{2}", amount, another.AccountHolderName, another.AccountNumber);
 }
Example #7
0
 public void AddAccount(BankAccount3 a)
 {
     accounts.Add(a);
     numberOfAccounts++;
 }