public bool TransferTo(double amount, BankAccountnew AccountToTransfer) { if (Withdraw(amount)) { AccountToTransfer.Deposit(amount); return(true); } else { Console.WriteLine("Transfer not succesful!"); return(false); } }
public static void Main() { Customer c1 = new Customer("Raniah", "39 Prince Georges Park,12-30", "D23467", new DateTime(1993, 07, 09)); Customer c2 = new Customer("Shamil", "113 Clementi St 13,02-37", "V73662", new DateTime(1991, 03, 21)); BankAccountnew b1 = new BankAccountnew("F32642345", c1, 12000); BankAccountnew b2 = new BankAccountnew("A34567345", c2, 40000); BankAccountnew b3 = new BankAccountnew("D72157632", c1, 4000); //Console.WriteLine(b1.Show()); //Console.WriteLine(b2.Show()); ////b1.Deposit(1000); ////Console.WriteLine(b1.Show()); //b1.Withdraw(14000); //b1.TransferTo(14000, b2); //Customer c3 = new Customer("Basim", "SAUDI ARABIA", "f53333", 12); //Console.WriteLine(c3.Show()); //Customer c4 = new Customer("FATIMA", "SAUDI ARABIA AS_SAFA", "N63333", new DateTime(1995,11,25)); BankAccountnew[] am = c1.Accounts; for (int i = 0; i < c1.NumOfAccounts; i++) { Console.WriteLine(am[i].Show()); } //c1.Address = "Blaaaaaaaaaaa";//setting //Console.WriteLine("{0:D} ,{1} , {2}, {3}", c2.DOB, c2.GetAge(), c1.GetAge(), c1.Address); }
//method public void AddAccount(BankAccountnew a) { accounts[numOfAccounts] = a; numOfAccounts++; }