Class Hierarchy
This class must extend the SavingsAccount
class.
Attributes
This class must contain the following attributes. It may contain other attributes as well.
The limit Attribute:
double
named limit
that contains the limit on available funds (i.e., the maximum amount
of money that can be available for withdrawal at any point in time).
The unavailableBalance Attribute:
double
named
unavailableBalance
that is used to keep track of the amount of money in the account that
is not available for withdrawal. This value must be increased anytime
a deposit is made that increases the total balance over the limit
on available funds.
Methods
This class must contain the following methods. It may contain other methods as well.
Constructor:
double
(the limit on available funds). If the value
of the parameter is negative it must be ignored. That is, if the
value of the parameter is negative there must be no limit on
available funds. (You might find the constant DBL_MAX
that is defined in cfloat
useful in this regard.)
The deposit Method:
deposit
that is passed
a double
containing the amount of the deposit and
does not return anything.
This method overrides the method with the same name in the
FixedTermSavingsAccount
class.
If the value of the parameter is negative it must be ignored, otherwise it must be added to the balance.
If the deposit increases the balance over the limit on available funds then the difference must be moved into the "unavailable balance". For example, suppose the old balance is $500 and the limit is $700. A deposit of $300 will result in balance of $800, $100 of which will be unavailable for withdrawal.
The getAccountID Method:
getAccountID
that has no parameters and returns an int
. The return
value should be 30000 plus the account number.
Copyright 2010