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 synchronized Money | getBalance()
return _balance;
|
public synchronized void | makeDeposit(Money amount)
checkForNegativeAmount(amount);
_balance.add(amount);
return;
|
public synchronized void | makeWithdrawal(Money amount)
checkForNegativeAmount(amount);
checkForOverdraft(amount);
_balance.subtract(amount);
return;
|