static void Main(string[] args) { Customer customer1 = new Customer("samyu", "addr1", "1234566"); BankAccount4 account1 = new BankAccount4("100001", customer1, 2000); account1.Deposit(2000); account1.WithDraw(2000); System.Console.WriteLine("The account1 customer is " + account1.Show()); Customer customer2 = new Customer("adi", "addr2", "1234566"); BankAccount4 account2 = new BankAccount4("100002", customer2, 3000); account2.TransferTo(account1, 3000); System.Console.WriteLine("The account2 customer is " + account2.Show()); account1.CreditInterest(account1.CalculateInterest()); System.Console.WriteLine("The account1 customer in savings accountis " + account1.Show()); CurrentAccounts currentAccount = new CurrentAccounts("100001", customer1, 2000); currentAccount.CreditInterest(currentAccount.CalculateInterest()); System.Console.WriteLine("The account1 customer is " + currentAccount.Show()); OverDrafts overDraft = new OverDrafts("100001", customer1, 2000); overDraft.WithDraw(2000); overDraft.WithDraw(2000); overDraft.WithDraw(2000); overDraft.WithDraw(2000); overDraft.CreditInterest(overDraft.CalculateInterest()); System.Console.WriteLine("The account1 customer is " + overDraft.Show()); }
void TransferTo(BankAccount4 bankAccountNumber, double amount) { if (WithDraw(amount)) { bankAccountNumber.Deposit(amount); } }
public double TotalInterestPaid() { double total_interest = 0; for (int i = 0; i < BankAccounts.Count; i++) { BankAccount4 bankAccount = (BankAccount4)BankAccounts[i]; double intr = bankAccount.CalculateInterest(); if (intr > 0) { total_interest += intr; } } return(total_interest); }
public double TotalDeposits() { double Bankbalance = 0; for (int i = 0; i < BankAccounts.Count; i++) { BankAccount4 bankAccount = (BankAccount4)BankAccounts[i]; double bal = bankAccount.Balance; if (bal > 0) { Bankbalance = Bankbalance + bal; } } return(Bankbalance); }
public double TotalInterestEarn() { double totalInterestEarned = 0; for (int i = 0; i < BankAccounts.Count; i++) { BankAccount4 bankAccount = (BankAccount4)BankAccounts[i]; Console.WriteLine("TotalInterestEarn {0}", bankAccount); double intrEarned = bankAccount.CalculateInterest(); if (intrEarned < 0) { totalInterestEarned = totalInterestEarned + (-intrEarned); } } return(totalInterestEarned); }
public void PrintCustomers() { ArrayList customers = new ArrayList(); System.Console.WriteLine("Inside bank branch " + BankAccounts.Count); for (int i = 0; i < BankAccounts.Count; i++) { BankAccount4 accounts = (BankAccount4)BankAccounts[i]; Customer cust = accounts.AccountHolder; int customerIndex = customers.IndexOf(cust); if (customerIndex < 0) { customers.Add(cust); } } for (int j = 0; j < customers.Count; j++) { Customer cus = (Customer)customers[j]; System.Console.WriteLine("Print customers " + cus); } }
public void AddAccount(BankAccount4 bankAccount) { BankAccounts.Add(bankAccount); }