Advanced Programming - CS239 |
|
|
|
|
|
|
|
|
Software
Requirements Specification:
Programming Assignment 3
Due
Tuesday, March 22, 10:00pm
Introduction
Purpose: A "banking" application called JMUsury.
Background
General
Information: JMU is about to
introduce a new service called JMUsury. This service will allow
students to save money for graduation.
The service will
offer three different kinds of accounts (none of which earn any interest):
Fixed Term
Savings Account: An account that
allows deposits at any time but withdrawals only upon graduation.
Savings Account: An account that allows deposits and withdrawals at
any time.
Mixed Savings
Account: An account that allows
deposits at any time and withdrawals of only a portion of the balance.
Specifically, whenever the balance gets above a predetermined limit, the
"overage" is moved into an "unavailable balance" that can't
be withdrawn from.
Existing
Components: The FixedTermSavings.java
account class has already been implemented. The
source code is available and must not
be modified.
New Components: You must develop the following classes:
SavingsAccount
MixedSavingsAccount
Driver
These classes must
not be in a package. You will need to
submit all 4 classes (include the FixedTermSavingsAccount.java).
Detailed
requirements for each of these classes are given below.
Details
Account Numbers:
Account
numbers must be unique and must be sequential. The first account number that is
created must be 1 (regardless of the type of account), the second must be 2
(again, regardless of the type of account), etc...
The
SavingsAccount Class:
This
class must extend the FixedTermSavingsAccount
class and must:
String
username. String getAccountID()
method that overrides the version in FixedTermSavingsAccount
. IDs of savings accounts must begin with
"SA-" rather than "FT-". withdraw
method that is passed a double (the amount of
the withdrawal) and returns a String (a message describing both
successful and unsuccessful withdrawals that includes information about
the amount of the withdrawal). This class may
contain other methods and attributes as well.
The
MixedSavingsAccount Class:
This
class must extend the SavingsAccount
class and must:
String
user name and a double
limit. deposit()
method that is passed a double
containing the amount of the deposit and
returns a String
containing a message describing the outcome of
the deposit (including the amount of the deposit and an indication of
whether the limit on available funds was exceeded). This method
overrides the version in the FixedTermSavingsAccount
class. If the deposit
increases the balance over the limit on available funds then the difference is
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.
String getAccountID()
method that overrides the version in SavingsAccount
. IDs of mixed savings accounts must begin with
"MS-" rather than "SA-" or "FT-". String getBalanceMessage()
method that overrides the version in SavingsAccount
. The message must contain information about
both the available balance and the unavailable balance. This class may
contain other methods and attributes as well.
The Driver Class:
You
must write a driver that tests all aspects of the classes above.
Evaluation:
Your program will be evaluated using a standard instructor driver. If you change your methods in any way from
the listed method specifications your program may fail the driver test.
You will also be evaluated on the completeness of your own tests. Your tests in Driver.java should fully test
each kind of account and the methods that may be called within each.
As usual, you will also be evaluated based on the conformance of your
program to the course style guides.
Hints:
Even
though this application is not very large, it will be easier to complete if you
do divide it into pieces. You should:
SavingsAccount
class. SavingsAccount
class. SavingsAccount
class. MixedSavingsAccount
class. MixedSavingsAccount
class. MixedSavingsAccount
class. Questions to
Think About:
How
could these classes be improved by changing the accessibility of some
attributes or methods to protected
?
Copyright ©2005