Exemplo n.º 1
0
        private void AddFunds(BankAccount account,decimal value)
        {
            if (value <= 0)
                throw new ArgumentException("The amount must be bigger than 0");

            account.Balance += value;
        }
Exemplo n.º 2
0
        private void RemoveFunds(BankAccount account,decimal value)
        {
            if (value <= 0)
                throw new ArgumentException("The amount must be bigger than 0");
            if (value > account.Balance)
                throw new Exception("Insuficient funds!");

            account.Balance -= value;
        }
Exemplo n.º 3
0
 public void DepositFunds(BankAccount account,decimal value)
 {
     AddFunds(account,value);
 }
Exemplo n.º 4
0
 public void WithdrawFunds(BankAccount account,decimal value)
 {
     RemoveFunds(account, value);
 }
Exemplo n.º 5
0
 public void TransferFunds(BankAccount fromAccount,BankAccount toAccount,decimal value)
 {
     RemoveFunds(fromAccount, value);
     AddFunds(toAccount, value);
 }
Exemplo n.º 6
0
 public void DeductServiceFee(BankAccount account)
 {
     account.DeductServiceFees();
 }