Bank Transactions


This assignment will give you practice w/user and program interfaces, and choosing/building useful data structures.

You will maintain a flat-file log, essentially, allowing users to query, and add an entry.

The Assignment

Write a command-line utility called accounts that uses what is, essentially a log file, list of transactions (deposits and withdrawals).

The account number will be the primary key; that is, no 2 accounts may have the same account number. 2 different accounts may, however, have the same name. (E.g., you may have a checking account, and a savings account.)

You will allow the user to view account info, and history, and to add transactions, as follows:

Options, and Descriptions

You may assume that all names are entered exactly. That is, do not worry about inconsistencies in spelling or capitalisation. E.g., John Doe, Jonathon Doe, and john doe are 3 different clients for this assignment. Further, for purposes of alphabetising, take the name to be that single string. Don't attempt to extract first, last name information.

If no argument is supplied, print a usage message and exit.

File Format

Account information will be stored in a flat file w/the format shown in sample.log:

Each line contains the account # (a string of 4 numbers), the account holder's name, the date (YY.MM.DD), the transaction type, and the amount, separated by colons.

To simplify things, the filename (location of the log) will be stored in an exported environment variable, $ACCT_LIST .

Example Output

Target Language

You can do this in any language you choose, including Bash or AWK. The language must be currently hosted on the tux machines.

If you, e.g., do this in Java, then you'll need to supply a shell script called accounts that invokes your program, the JRE, whatever, w/the arguments.

Hints (maybe)


Since you can do this in a number of languages, submit a makefile . I've provided templates:

  • sample Python makefile
  • sample Java makefile
  • sample C++ makefile
  • See my notes on makefiles for help.

    Submit the following files.

    Please note: You will use the filenames as listed here, and submit them all to the proper assignment. If this is not clear, then see me in class. If I get programs submitted to the wrong directories, I will be irate, which may, in some subconscious way, affect your grades. Adversely.