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