Project Description
Congratulations!!
You have been awarded a large contract to write software for the
F & R Savings and Loan. F & R is a small locally owned S & L that
offers savings accounts and checking accounts to its customers.
However, the owners of F & R forsee a time when other accounts will be
offered. Therefore, their software gurus have designed an object-oriented
bank account system which you have been hired to implement.
To allow for seamless addition of new account types, the bank account system
is designed with an abstract bank account class from which all other account
types will be derived. The class heirarchy is shown in the diagram below
Your job is to implement the BankAcct, SavingsAcct, CheckingAcct and Check
classes which are described in more detail below.
In order to get paid, your classes must pass rigourous testing by F & R.
F & R testers will compile and link your code with test programs which
they will write. A simple test program, Proj4.cpp is provided for your
initial testing and can be copied from Mr. F's public directory.
Class Descriptions
The class descriptions below must be followed exactly. You and the F & R
software team have agreed upon all class interfaces, so the F & R team expects
that your files, classes and their public methods will be named exactly as listed
below. Deviation from these agreed upon names will result in breach of contract
since your code will not link with the test code from F & R.
You and F & R have agreed on the following implementation rules. Failure to
follow these rules will result in a reduction of your compensation.
Also note that the data in these accounts is very sensitive. F & R expect that
you will implement all possible security measures to protect their data.
- No friends allowed
- No public methods other than those specified below are permitted
(you may create whatever private methods you deem necessary).
- Since the BankAcct class does not provide accessors, some (not all)
of the data members of the BankAcct class may be "protected".
The Base Bank Account class
The generic bank account class at the top of the hierarchy must
be named BankAcct. Its interface must be found in BankAcct.h and implemented
in BankAcct.cpp. Note that this class is an abstract base class.
The BankAcct class supports the following interface
- a default constructor
- BankAcct ( const string& name, int number) - an alternative constructor.
name is the name of the account owner
number is the account number
- a destructor
- void Deposit( double amount) -- deposits money into the account
amount is the deposit amount in dollars and cents
- void Withdraw( double amount) -- withdraws money from the account
amount is the withdraw amount in dollars and cents.
It is an error if the withdraw amount is greater than the current balance.
- double Balance(void) -- a "pure virtual" function that returns
the the account balance in dollars and cents
- void Print( ostream& out = cout ) -- a virtual
function that prints the bank account information. The default behavior
is to print the account owner's name, the account number,
the number and amount of the deposits and withdraws and the balance. See
the sample output below for an acceptable format.
Saving Account
The savings account is implemented in the SavingsAcct class.
The SavingsAcct class is implemented in SavingsAcct.cpp and its interface is defined
in SavingsAcct.h as described below. The SavingsAcct class is derived from the BankAcct
class.
- a default constructor
- SavingsAcct( const string& name, int number, double rate)
-- an alternative constructor
name is the name of the account owner
number is the account number
rate is the interest rate (5.00 = 5%)
- a destructor
- void Print( ostream& out = cout ) which prints the details
of the savings account. In addition to the information provided by the
BankAcct, the interest rate, interest amount (rate * balance) and account
balance are also printed. See the sample output
below for an acceptable format.
- double Balance( void ) -- returns the account balance
in dollars and cents
- The insertion operator (operator<<) must also be
provided for the SavingsAcct class.
Checking Account
The checking account is implemented in the CheckingAcct class.
The CheckingAcct class is implemented in CheckingAcct.cpp and its interface is defined
in CheckingAcct.h as described below. The CheckingAcct class is derived from the BankAcct
class. The CheckingAcct can support an unlimited number of cashed checks.
- a default constructor
- CheckingAcct( const string& name, int number)
-- an alternative constructor
name is the name of the account owner
number is the account number
- a destructor
- void Print( ostream& out = cout ) which prints the details
of the checking account. In addition to the information provided by the
BankAcct, a list of cashed checks, the number and total of all checks cashed and
the account balance are also printed.
See the sample output
below for an acceptable format.
- double Balance( void ) -- returns the account balance
in dollars and cents.
- void CashCheck(int checkNr, double amount ) -- adds the
check to the list of cashed checks. If the check amount is greater than the
current account balance a negative account balance results.
Multiple checks with the same number are permitted. Like all other
amounts, the check amount is in dollars and cents.
- The insertion operator (operator<<) must also be
provided for the CheckingAcct class.
To support the implementation of the CheckingAcct class, you will also
implement a class to model a check, cleverly named Check.
The Check class is implemented in Check.cpp and its interface is defined
in Check.h as described below.
- a default constructor
- Check (unsigned int checkNr, double amount)
checkNr is the check number
amount is the check amount in dollars and cents
- unsigned int GetCheckNr(void) - accessor for the check number
- double GetCheckAmt(void) - accessor for the check amount
- a destructor
Other project requirements
- To support F & R's plans for future account types, you will supply
the polymorphic function
void PrintAllAccts( const vector< BankAcct * >& accounts).
The prototype for this function is found in BankAcct.h and it is implemented
in BankAcct.cpp.
The parameter accounts is a const vector of pointers to BankAcct objects
which is passed by reference.
This function uses polymorphism to print the details of all accounts pointed
to by the vector.
- Because the F & R gurus are semi-senile they require that all private
and protected data members of your classes be dynamically allocated.
Extra Credit
As is apt to happen, F & R has requested a last minute change
to your contract. They are willing to pay and additional 10%
for completion of this extra work. This work is optional. You are under no obligation
to complete the work.
To be rewarded with extra compensation, your project must provide the
following extra functionality, based on the design agreed to by your software
development team and the F & R gurus described below.
These changes must be implemented with no changes to the public
interface of any class already specified in the project description.
F & R desires that a list of all deposit and withdraw amounts be printed
as part of the BankAcct statement (like the checks in the CheckingAcct),
rather than just the number and total deposit and withdraw amounts
(which are still required). The new account statement might look like
the one shown below, but any readable format is acceptable. To facilitate
this change, and with a view toward future enhancements, your team and the
F & R gurus have designed a new class - the Transaction class.
The Transaction class contains the amount of the transaction along
with appropriate constructor(s), destructor and accessor(s). The overloaded
output operator (operator<<) is also required. The Check class
will now be derived from the Transaction class since, in addition to the amount
of the check, there will also be a check number.
Questions about this new requirement should be directed to the F & R bulletin
board.
linux3[18]% Proj4
Acct Number: 9876
Owner : Mr. Raouf
2 Deposits totaling 70.25
60.00
10.25
2 Withdraws totaling 32.50
25.50
7.00
Dep/WD Total: 37.75
Interest at 5.00% 1.89
Account Balance: 39.64
---------------------
Acct Number: 1234567
Owner : Mr. Frey
1 Deposits totaling 500.00
500.00
1 Withdraws totaling 2.45
2.45
Dep/WD Total: 497.55
Checks:
101 4.00
102 14.00
110 24.00
Check Total( 3): 42.00
Account Balance: 455.55
---------------------
If you opt for the extra work, please submit a README file with your project
to alert the grader that your project supports the extra credit functionality.
Project Makefile
For this project, you will be responsible for providing your own makefile.
Typing "make" should compile and link all files for your project.
Your makefile should also support the commands "make clean" and "make cleanest".
If you start with the makefile for project 3, the changes for project 4 are
straightforward.
Grading
The grade for this project will be broken down as follows. A more detailed
breakdown will be provided in the grade form you recieve
with your project grade.
85% - Correctness
This list may not be comprehensive, but everything on this list will be
verified by the graders.
- All file and class names match the specification
- All function signatures match the specification
- All required output present
- All required output correct for various test files
- Output presented in a reasonable format
Part of the design assignment is to consider what the various
error conditions might be tested.
- Incorrect command line (ie wrong number of arguments) handled
- Proper OO design and implementation
- All error conditions detected
- NO FRIENDS allowed
15% - Coding Standards
Your code adheres to the