Class CheckingAccount
java.lang.Object
BankAccount
CheckingAccount
- public class CheckingAccount
- extends BankAccount
A CheckingAccount is a BankAccount with one new feature:
the ability to cash a check by calling the honorCheck method.
Each honored check costs the customer a checkFee.
- Version:
- 7
- See Also:
BankAccount
Constructor Summary |
CheckingAccount(int initialBalance,
Bank issuingBank)
Constructs a CheckingAccount with the given
initial balance and issuing Bank. |
Method Summary |
int |
honorCheck(int amount)
Honor a check:
Charge the account the appropriate fee
and withdraw the amount. |
void |
newMonth()
Nothing special happens to a CheckingAccount on the
first day of the month. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CheckingAccount
public CheckingAccount(int initialBalance,
Bank issuingBank)
throws InsufficientFundsException
- Constructs a CheckingAccount with the given
initial balance and issuing Bank.
Counts as this account's first transaction.
- Parameters:
initialBalance
- the opening balance for this account.issuingBank
- the bank that issued this account.
- Throws:
InsufficientFundsException
- when appropriate.
honorCheck
public int honorCheck(int amount)
throws InsufficientFundsException
- Honor a check:
Charge the account the appropriate fee
and withdraw the amount.
- Parameters:
amount
- amount (in whole dollars) to be withdrawn.
- Returns:
- the amount withdrawn.
- Throws:
InsufficientFundsException
- when appropriate.
newMonth
public void newMonth()
- Nothing special happens to a CheckingAccount on the
first day of the month.
- Specified by:
newMonth
in class BankAccount