|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbanking.SimpleAccountImpl
A simple banking SimpleAccountImpl class.
Field Summary | |
private float |
accountBalance
The account balance. |
private int |
accountNumber
The account number. |
(package private) static java.util.logging.Logger |
logger
|
Constructor Summary | |
SimpleAccountImpl(int number,
float balance)
Constructs an SimpleAccountImpl with the specified number. |
Method Summary | |
void |
credit(float amount)
Adds an amount to the current balance of this account. |
void |
debit(float amount)
Deducts an amount from the current balance of this account. |
int |
getAccountNumber()
Returns the number of this account. |
float |
getBalance()
Returns the current balance of this account. |
void |
setBalance(float amount)
Sets the balance of this account. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static java.util.logging.Logger logger
private int accountNumber
private float accountBalance
Constructor Detail |
public SimpleAccountImpl(int number, float balance)
SimpleAccountImpl
with the specified number.
number
- The account numberbalance
- The initial balanceMethod Detail |
public int getAccountNumber()
getAccountNumber
in interface Account
public float getBalance() throws AccountException
getBalance
in interface Account
AccountException
- If a problem occurs during
this operation, e.g., a problem to access the underlying
database if any.public void setBalance(float amount) throws AccountException
setBalance
in interface Account
amount
- The balance to be set
AccountException
- If a problem occurs during
this operation, e.g., a problem when updating the underlying
database if any.public void credit(float amount) throws AccountException
credit
in interface Account
amount
- The amount to add.
AccountException
- If a problem occurs during
this operation, e.g., a problem when accessing/updating
the underlying database if any.public void debit(float amount) throws AccountException
debit
in interface Account
amount
- The amount to be deducted.
AccountException
- In case the amount to deduct
is greater than the current balance, or if a problem occurs
when querying/updating the underlying database if any.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |