PROJECT I (**** additional information added on July 19 at 1pm)
Due Date:July 28 at midnight.
Account Maintenance  

In this project, you will write a program in C++ (Click here for an introduction to C++ by Tom Anderson) to simulate the ATM machine  at a local bank. Use the "g++" compiler  (or CC compiler as shown below) available on "nova" server for this project. Ensure you document your code so that it is readable. Design and documentation will be a worth significant  part of the grade. The description of the ATM machine is as given below.

Customers at ``ABC Bank" will open new accounts, withdraw and deposit moneys. Customers may hold only checking accounts. When customer opens an account, the customer specifies a starting balance (should be non negative) and name. When withdrawing an amount, the customer is given cash if there is sufficient amount, otherwise the customer is charged $10 for insufficient fee. If the account has less than $10, the customer is charged whatever amount is in the account.

Various customers use the system by providing the necessary information to perform their transactions. Note that a customer's account must be in the database until the customer closes it, even if several  customers are using the ATM. The ATM provides the following menu choices. The program repeats the menu choices as many times as is provided in a command line option.

o -- open new account  (read name, initial deposit and then open  a checking account and give an account number to the customer. The choice of account number is yours. But it must be different for each customer.)
t --  transactions on existing account
c -- close an  account

Note that a  customer  must open account before doing transactions or closing the account.  If "c" or  "t"  is chosen the customer is asked to provide the account number and name , and if the account number and name are found in an account in the database,  then account is closed if "c" is chosen and the following menu appears if "t" is chosen.

d --- deposit (a given amount of cash is deposited into the account.)
w --- withdraw   (asks for the amount to withdraw, and withdraws and gives cash, if there is enough money in the account, otherwise insufficient service fee charged as described above. )
i ---- inquire balance (prints the current balance)
g --- go back to previous menu

The above menu repeats until the customer chooses "g".

Although there are variations in the design choice, here are the classes you must have:

1. Account: Contains common functions and variables for both accounts.
2. DataBase: Contains the database (array) of all the accounts and functions  to
   open/close accounts.
3. Menus:  Contains methods that display menus.

Turn in a hard copy of the program and a few sample runs illustrating that all of the above menu options function correctly. Also mail the program to "skanchi@kettering.edu" before midnight. The hard copies and sample runs are due by class time on the next morning of the due date.
NEW (Added on July 19 at 1pm): Here is some additional help for you to get going with your assignment. First to obtain a hard copy of the sample run, use the "script" command. If you type

>script output

then all the input and output the terminal is captured into a file named "output" until you type <CTRL>-D. Then you can print the output file to a printer.

To see an example of a seperate compilation of a C++ program, I have provided the following programs for you to try out.

Tree. cc






Use the following commands to compile the files above:

CC -c Tree.cc

CC -c TreeNode.cc

CC Tree.o TreeNode.o main.cc

The first two lines compile the files Tree.cc and TreeNode.cc respectively and they create the files Tree.o and TreeNode.o. The last line then links the object files (*.o) with the main.cc and creates a.out file. Now to run the program, type


It will ask for an input file, now provide the "testfile" as input file. It should produce an output. Please look into these files carefully and try to understand their dependencies. It should be a good guideline to design your program.

Note: You have to be in "nova" for the above commands to work, unless you want to set paths etc.

Saroja Kanchi's Homepage