FileDocCategorySizeDatePackage
Account_Impl.javaAPI DocExample1158Thu Nov 08 00:23:40 GMT 2001com.ora.rmibook.chapter23.corbaaccounts

Account_Impl

public class Account_Impl extends _AccountImplBase

Fields Summary
private Money
_balance
Constructors Summary
public Account_Impl(Money startingBalance)

        _balance = startingBalance;
    
Methods Summary
private voidcheckForNegativeAmount(Money amount)

        int cents = amount.cents;

        if (0 > cents) {
            throw new NegativeAmountException();
        }
    
private voidcheckForOverdraft(Money amount)

        if (amount.cents > _balance.cents) {
            throw new OverdraftException();
        }
        return;
    
public MoneygetBalance()

        return _balance;
    
public voidmakeDeposit(Money amount)

        checkForNegativeAmount(amount);
        _balance.cents += amount.cents;
        return;
    
public voidmakeWithdrawal(Money amount)

        checkForNegativeAmount(amount);
        checkForOverdraft(amount);
        _balance.cents -= amount.cents;
        return;