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); } }