Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 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);
             * }
             */
        }
Exemplo n.º 5
0
 public void AddAccount(BankAccount3 b)
 {
     BankAccounts.Add(b);
 }
Exemplo n.º 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);
 }
Exemplo n.º 7
0
 public void AddAccount(BankAccount3 a)
 {
     accounts.Add(a);
     numberOfAccounts++;
 }