Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void decrease(int amount) throws NotEnoughMoneyException {
- int walletMoney = this.wallet.getAmountOfMoney();
- if(walletMoney < amount)
- throw new NotEnoughMoneyException();
- else if(walletMoney == amount)
- this.wallet.updateState(new EmptyState(this.wallet));
- else
- this.wallet.safeDecrease(amount);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement