University of Calgary

cpsc 233 transition - bank machine


Assignment 1 : TRANSITION
Becker's ATM
Assignment Links:
Java Shell
Pascal Source
Sample Run (txt)
Input only
C-Version
B-Version
A-Version

Goals, Skills and Concepts:
- learn basic syntax of new language
- become familiar with creating, 'compiling' and running Java programs.

Introduction and Background:
This is the first programming assignment in this course. The main goal here is to become familiar with the syntax of Java, and with creating and running java programs in the current environemnt. You should attempt to use all the major constructs already learned in Pascal: declarations; decisions; loops; arrays; sub-programs.

This particular problem will fit easily into a simple Java framework and requires no real re-organization.

Description:
You have been given the Pascal code for a program that emulates a simple bank machine ('Bank.p' and 'BankA.p') and the framework for a Java application: ('Bank.java' ). This program reads 2 things: a letter which represents the desired transaction, and then a dollar amount (if approriate). Invalid numbers are treated as zeros. The program processes the requested transaction and then prints the result. Users may loop (i.e. repeat) as often as desired.

Specifications:
- may create own framework if desired but not necessary
- may NOT change the basic functionality of the program
- input and output must appear as in the sample
- do not create any new classes

Approach:
This is a smallish program, requiring no new material except the new syntax. This assignment does not require the definition of new classes other than the 'main' one so all required functions and all 'global' data may be static.
The Java version does not need to implement any additional functionality than the original Pascal does.

Testing & Marking:
There are two sample executable versions in the course directory (on the unix servers only):
~becker/Courses/233/A1/Bank { the 'C' version }
~becker/Courses/233/A1/BankA { the 'A' version }
Note the format of the output. This assignment will be automatically graded by checking your output against that of the test programs. That means that the output produced must be IDENTICAL to the samples, or the grader will not recognize it. This assignment will not be individualy marked, but they will be checked against each other.

To run your program from the command line and feed it input from a file instead of typing it interactively, run your program like this:
./BankA < out-a-input.txt
There is no need to change your program. This simply "fools" your program (temporarily) into reading from the specified file. This is not true file I/O. It is called redirected I/O. You have simply changed the source of the input stream from the standard input 'channel' to the file you have named. The program will run as normal, but the input is not echoed.

If you wish to run the sample Pascal versions, copy them into your directory, and compile them with (replace names as appropriate):
gpc BankA.p -o BankA
'C' Version:
- program Bank converted to Java with no embellishments
Always prints 'intermedate' balance
Functions supported:
print current balance
process withdrawal [permit overdrafts but make them obvious]
process deposit

'B' Version:
- program Bank converted to Java that allows more than one bank account [up to 5] (using arrays). User will specify which account before the other input is requested. Accounts are assumed to exist before the program is started.
Functions supported:
as in 'C' plus:
specify account
process transfers from one account to another
print all balances

'A' Version:
- program Bank with multiple accounts AND...
- allow user to create 'new' accounts and close existing ones [outstanding balance must be transfered to another account]

Functions supported:
as in 'B' plus:
open a new account
close an account

~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-*~'`^`'~*-,._.,-

Updated: January 17, 2006 03:21 PM