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