Methods Summary |
---|
private void | checkForNegativeAmount(Money amount)
int cents = amount.getCents();
if (0 > cents) {
throw new NegativeAmountException();
}
|
private void | checkForOverdraft(Money amount)
if (amount.greaterThan(_balance)) {
throw new OverdraftException(false);
}
return;
|
public Money | getBalance()
return _balance;
|
public void | makeDeposit(Money amount)
checkForNegativeAmount(amount);
_balance.add(amount);
return;
|
public void | makeWithdrawal(Money amount)
checkForNegativeAmount(amount);
checkForOverdraft(amount);
_balance.subtract(amount);
return;
|