static void Main(string[] args) { // Customer cust1 = new Customer("Tah Ah Kow", "20,Seaside Road", "XXX20", new DateTime(1989, 10, 11)); //Customer cust2 = new Customer("Kim Lee Keng","2.Rich View", "XXX9F", new DateTime(1993, 10, 11)); //BankAccount_3 bankAcc1 = new BankAccount_3("001-001-001", "Tan Ah Kow", 2000); //BankAccount_3 bankAcc2 = new BankAccount_3("001-001-001", "Kim Keng Lee", 5000); //Console.WriteLine(bankAcc1.Show()); //bankAcc1.Deposit(500); //Console.WriteLine(bankAcc1.Show()); //bankAcc1.Withdraw(200); //Console.WriteLine(bankAcc1.Show()); //bankAcc1.Transfer(300, bankAcc2); //Console.WriteLine(bankAcc1.Show()); //Console.WriteLine(bankAcc2.Show()); //3.2 Workshop Customer cust1 = new Customer("Tah Ah Kow", "20,Seaside Road", "XXX20", new DateTime(1989, 10, 11)); Customer cust2 = new Customer("Kim Lee Keng", "2.Rich View", "XXX9F", new DateTime(1993, 10, 11)); BankAccount_3 bankAcc1 = new BankAccount_3("001-001-001", cust1, 2000); BankAccount_3 bankAcc2 = new BankAccount_3("001-001-001", cust2, 5000); bankAcc1.Deposit(500); // Console.WriteLine(bankAcc1.Show()); bankAcc1.Withdraw(200); //Console.WriteLine(bankAcc1.Show()); bankAcc1.Transfer(300, bankAcc2); //Console.WriteLine(bankAcc1.Show()); //Console.WriteLine(bankAcc2.Show()); }
public void CreditInterest() { for (int i = 0; i < listOfBankAccount.Count; i++) { BankAccount_3 a = (BankAccount_3)listOfBankAccount[i]; a.CreditInterest(); } }
public double TotalDeposit() { double total = 0; for (int i = 0; i < listOfBankAccount.Count; i++) { BankAccount_3 b = (BankAccount_3)listOfBankAccount[i]; total += b.Balance; } return(total); }
public bool Transfer(double amount, BankAccount_3 anotherAccount) { if (Withdraw(amount)) { anotherAccount.Deposit(amount); return(true); } else { Console.Error.WriteLine("Transfer to {0} is unsuccessful", anotherAccount.AccountHolder); return(false); } }
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); }
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); }
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()); }
public void PrintCustomers() { ArrayList cust = new ArrayList(); Console.WriteLine("Customer Name\tAddress\tPassportNo\tAge"); for (int i = 0; i < listOfBankAccount.Count; i++) { BankAccount_3 b = (BankAccount_3)listOfBankAccount[i]; Customer c = b.AccountHolder; int numIndex = cust.IndexOf(c); if (numIndex < 0) { cust.Add(c); } } for (int j = 0; j < cust.Count; j++) { Console.WriteLine("{0}", cust[j]); } }
public void AddAccount(BankAccount_3 bankAccount) { listOfBankAccount.Add(bankAccount); }