Cs102 Fall 2005 Lab5
Due Date: December 12th 14th at midnight.
Summary:
In this lab you will develop a very simple graphical interface to allow
a bank teller access to a customer's bank account. You will work
with inheritance and polymorphism in this lab.
This is the last lab of the semester. You have a little more time to do
it than usual and there is a bit more work than usual. You should start
early and find any potential problems in the lab early on.
Objectives:
In this lab you will
- Implement the is-a (inheritance) relationship
- Work with polymorphism in C++
- method over-riding
- virtual functions
- using base class pointer variables to point at child class
objects.
- You will also review and improve your skills in:
- event driven programming
- working with simple graphical user interfaces
- work with libraries of existing code
- reading documentation for a library to use the features of that
library.
Your Task
You are to create a simple user interface for a simplified bank
program. The bank program needs to keep track of only a single
customer. That customer knows about a single savings account and a
single checking account object. However, you may *not* have any instance or local
variables of either type. Your variables must be of type Account
pointer. The account class is the parent class of both the
SavingsAccount and CheckingAccount classes. (see the UML below). Your
solution must include all of the elements in the UML diagram below.
However there are significant pieces of the UML that are omitted which
you will need to fill in. The Account class is complete and cannot be
modified. (Actual code will be given at the end of this assignment
specification). There are some requirements that you must
follow(enumerated for your conveneince below), but outside of those,
you have freedom to do fun and interesting things in this lab.
Your program must have the following behavior for your two account
classes:
- SavingsAccount::deposit - This is a very generous bank which
tried to encourage savings. After the user passes the method the amount
the deposit is for, this method should add the full deposit amount plus
one half of one percent extra to the current account balance.
- SavingsAccount::Withdraw - Takes the amount passed as the amount
to withdraw.
- If the amount passed is less than the balance, then the balance
should be reduced by that much
- If the amount passed is more than the balance, display (using a
GUI) a polite but firm message informaing the user that he/she does not
have that much money available.
- SavingsAccount::MonthlyMaintanance - add interest for the savings
account of 1% to
the total balance of the account. (a very generous bank indeed)
- CheckingAccount::deposit - (amount passed is the amount to
deposit) add the amount deposited to the account balance
- CheckingAccount::Withdraw - Takes the amount passed as the amount
to withdraw. If the amount to withdraw is less than the balance, just
reduce the balance by that amount. Otherwise, deliver a
warning message and then charge the account an "overdraft penalty" of
$24
- CheckingAccount::MonthlyMaintanance -If the balance is over $400
then no change,
but if the balance is under $400, then make a $4.50 charge (reduction
of the balance)
Most he look and feel of the User interface is up to you. You need a
way to display the checking and savings account balances in such a way
that the user can't change them except through the deposit and withdraw
methods. You also need a way to let the user select the depost,
withdraw and monthly maintanance methods by using the GUI. I put
together a quick and dirty GUI below that does all of this (but doesn't
look very good)
Enumerated requirements and restrictions for the lab(mostly from the
text above for your convenience)
- You must use the classes and class relationships from the UML
- You must use the Account.h file linked
here. You may not change this file
- You may not use any variables
of the CheckingAccount or SavingsAccount class. Of course you must use
objects of those types, but you need to keep track of them them using
Account pointer variables.
- You need to make your savings and checking accounts include the
funtionality given in the list above.
- You may not have any c-style non-class methods. (once again the
IMPLEMENT_APP will elminated the need for even a main method.
- Again, you may not have any method with more than 20 lines of
code. Remember, lets design the code well.
When you are ready to submit, send it to me by email as usual, zipped
with the usual readme.txt. The readme will be worth a little more this
time since you have more opportunity to design the program and make
implementation decisions. You also have more freedom in designing so I
need to be told how to run the program.
the readme.txt with
the usual information
- Your name
- The name of your cpp and h files and the classes that they
represent
- The implementation decisions that you made. Why did you solve the
problem the way that you did.
- Directions on running and using your program. Especially anything
that might not be the same for all students. (example: how will you
query user input for a deposit?)
- and of course any problems or bugs left in your program.