public TransferTransaction(Account fromAccount, Account toAccount, decimal amount) // ctor used to create the transfer object { _fromAccount = fromAccount; _toAccount = toAccount; _amount = amount; _theWithdraw = new WithdrawTransaction(_fromAccount, _amount); //create new object from the account to be withdraw from and the amount to transfer _theDeposit = new DepositTransaction(_toAccount, _amount); // create new object from the account to be tranferered in to }
private static void DoDeposit(Bank toBank) // deposit method { decimal input; //used to store the user inputted amount Account toAccount = FindAccount(toBank); if (toAccount == null) { return; } Utl.lineBreak(); Console.WriteLine("Enter how much you would like to deposit?"); input = Convert.ToDecimal(Console.ReadLine()); //store the amount after converting to decimal var deposit = new DepositTransaction(toAccount, input); //create a new deposit object deposit.Execute(); // excute the deposit on the deposit object deposit.Print(); // and print the object //account.Deposit(input); // call the Deposit method pass the amount to be deposited }