|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object BankAccount
A BankAccount object has private fields to keep track of its current balance, the number of transactions performed and the Bank in which it is an account, and and public methods to access those fields appropriately.
Bank
Constructor Summary | |
protected |
BankAccount(int initialBalance,
Bank issuingBank)
Construct a BankAccount with the given initial balance and issuing Bank. |
Method Summary | |
void |
countTransaction()
Increment by 1 the count of transactions, for this account and for the issuing Bank. |
int |
deposit(int amount)
Deposit the given amount, increasing this BankAccount's balance and the issuing Bank's balance. |
int |
getBalance()
Get the current balance. |
protected Bank |
getIssuingBank()
The bank that issued this account. |
int |
getTransactionCount()
Get the number of transactions performed by this account. |
protected int |
getTransactionFee()
Get transaction fee. |
void |
incrementBalance(int amount)
Increment account balance by given amount. |
abstract void |
newMonth()
Action to take when a new month starts. |
int |
requestBalance()
Request for balance. |
int |
withdraw(int amount)
Withdraw the given amount, decreasing this BankAccount's balance and the issuing Bank's balance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected BankAccount(int initialBalance, Bank issuingBank) throws InsufficientFundsException
initialBalance
- the opening balance.issuingBank
- the bank that issued this account.
InsufficientFundsException
- when appropriate.Method Detail |
public void countTransaction() throws InsufficientFundsException
InsufficientFundsException
- when appropriate.public int deposit(int amount) throws InsufficientFundsException
amount
- the amount to be deposited
InsufficientFundsException
- when appropriate.public int getBalance()
protected Bank getIssuingBank()
public int getTransactionCount()
protected int getTransactionFee()
public final void incrementBalance(int amount) throws InsufficientFundsException
amount
- the amount of the increment.
InsufficientFundsException
- when appropriate.public abstract void newMonth() throws InsufficientFundsException
InsufficientFundsException
- thrown when funds
on hand are not enough to cover the fees.public int requestBalance() throws InsufficientFundsException
InsufficientFundsException
- when appropriate.public int withdraw(int amount) throws InsufficientFundsException
amount
- the amount to be withdrawn
InsufficientFundsException
- when appropriate.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |