public void TransferTo(double amount, BankAccount3 another) { 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 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); BankAccount3 a1 = new BankAccount3("S0000223", cus1, 2000); Console.WriteLine(a1.CalculateInterest()); OverdraftAccount a2 = new OverdraftAccount("O1230124", cus1, 2000); Console.WriteLine(a2.CalculateInterest()); CurrentAccount a3 = new CurrentAccount("C1230125", cus2, 2000); Console.WriteLine(a3.CalculateInterest()); }
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 TransferTo(double amount, BankAccount3 another) { Withdraw(amount); another.Deposit(amount); }