Exemplo n.º 1
0
        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
        }
Exemplo n.º 2
0
        private static void DoWithdraw(Bank toBank) // withdraw method
        {
            decimal input;                          //used to store the user inputted amount
            Account fromAccount = FindAccount(toBank);

            if (fromAccount == null)
            {
                return;
            }


            Utl.lineBreak();
            Console.WriteLine("Enter how much you would like to withdraw?");
            input = Convert.ToDecimal(Console.ReadLine()); //store the amount after converting to decimal

            var withdraw = new WithdrawTransaction(fromAccount, input);

            withdraw.Execute();
            withdraw.Print();
            toBank.ExecuteTransaction(withdraw);
            // account.Withdraw(input); //call the Withdraw method passing the amount to be withdraw
        }