|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Bank
A Bank object simulates the behavior of a simple bank/ATM.
It contains a Terminal object and a collection of
BankAccount objects.
The visit method opens this Bank for business,
prompting the customer for input.
To create a Bank and open it for business issue the command
java Bank
.
BankAccount
Constructor Summary | |
Bank(String bankName,
Terminal atm)
Construct a Bank with the given name and Terminal. |
Method Summary | |
void |
countTransaction()
Increment by one the count of transactions, for this bank. |
int |
getBalance()
Get the current bank balance. |
int |
getCheckFee()
The charge this bank levies for cashing a check. |
double |
getInterestRate()
The current interest rate on savings. |
int |
getMaxFreeTransactions()
The number of free transactions per month. |
int |
getMonthlyCharge()
The charge this bank levies each month. |
int |
getNumberOfAccounts()
Get the current number of open accounts. |
int |
getTransactionCount()
Get the number of transactions performed by this bank. |
int |
getTransactionFee()
The charge this bank levies for a transaction. |
void |
incrementBalance(int amount)
Increment bank balance by given amount. |
static void |
main(String[] args)
Run the simulation by creating and then visiting a new Bank. |
void |
visit()
Simulates interaction with a Bank. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Bank(String bankName, Terminal atm)
bankName
- the name for this Bank.atm
- this Bank's Terminal.Method Detail |
public void countTransaction()
public int getBalance()
public int getCheckFee()
public double getInterestRate()
public int getMaxFreeTransactions()
public int getMonthlyCharge()
public int getNumberOfAccounts()
public int getTransactionCount()
public int getTransactionFee()
public void incrementBalance(int amount)
amount
- the amount increment.public static void main(String[] args)
A -e argument causes the input to be echoed. This can be useful for executing the program against a test script, e.g.,
java Bank -e < Bank.in
args
- the command line arguments:
-e echo input. bankName any other command line argument.
public void visit()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |