Class SavingsAccount

java.lang.Object
  extended byBankAccount
      extended bySavingsAccount

public class SavingsAccount
extends BankAccount

A SavingsAccount is a BankAccount that bears interest. A fee is charged for too many transactions in a month.

Version:
7
See Also:
BankAccount

Constructor Summary
SavingsAccount(int initialBalance, Bank issuingBank)
          Constructor, accepting an initial balance.
 
Method Summary
 void countTransaction()
          Increment count of transactions, for this account for this Month and in total and for the issuing Bank, by one.
protected  int getTransactionFee()
          Override getTransactionFee() to return a non-zero fee after the appropriate number of free monthly transactions.
 void newMonth()
          A SavingsAccount earns interest each month.
 
Methods inherited from class BankAccount
deposit, getBalance, getIssuingBank, getTransactionCount, incrementBalance, requestBalance, withdraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SavingsAccount

public SavingsAccount(int initialBalance,
                      Bank issuingBank)
               throws InsufficientFundsException
Constructor, accepting an initial balance.

Parameters:
initialBalance - the opening balance.
issuingBank - the bank that issued this account.
Throws:
InsufficientFundsException - when appropriate.
Method Detail

countTransaction

public void countTransaction()
                      throws InsufficientFundsException
Increment count of transactions, for this account for this Month and in total and for the issuing Bank, by one.

Overrides:
countTransaction in class BankAccount
Throws:
InsufficientFundsException - when appropriate.

getTransactionFee

protected int getTransactionFee()
Override getTransactionFee() to return a non-zero fee after the appropriate number of free monthly transactions.

Overrides:
getTransactionFee in class BankAccount
Returns:
the fee for current transaction.

newMonth

public void newMonth()
              throws InsufficientFundsException
A SavingsAccount earns interest each month.

Specified by:
newMonth in class BankAccount
Throws:
InsufficientFundsException - when appropriate.