//Listing 10.3 AccountSimpleImpl.java

package banking;

public class AccountSimpleImpl implements Account {
    private int _accountNumber;
    private float _balance;

    public AccountSimpleImpl(int accountNumber) {
	_accountNumber = accountNumber;
    }

    public int getAccountNumber() {
	return _accountNumber;
    }

    public void credit(float amount) {
	_balance = _balance + amount;
    }

    public void debit(float amount)
	throws InsufficientBalanceException {
	if (_balance < amount) {
	    throw new InsufficientBalanceException(
			   "Total balance not sufficient");
	} else {
	    _balance = _balance - amount;
	}
    }

    public float getBalance() {
	return _balance;
    }
}
