The First National Bank ATM Simulator
Purpose
The First National Bank ATM Simulator was developed by Corey Jackson, Haihua Li and Tom Scanlon to meet the requirements of IS2470 at the University of Pittsburgh.
Objectives
The goal of this project was to develop a reasonably advanced Java applet that demonstrates a basic core knowledge of Java applet design and also exhibits interactive functions such as the use of widgets, graphics and sounds. To accomplish this goal the group considered several design ideas submitted by each group member and ultimately decided to implement an applet that simulates an ATM banking machine.
The finished project should be a fully functional ATM interface applet that incorporates all of the Java requirements stated above and also demonstrates the concepts of superior human interface design as we have learned in class. The intended users of our applet are grade-school age children who are learning about money and banking in school. These students have likely seen an ATM used by others, such as their parents, but probably have never had the chance to use one personally. This ATM simulator will provide them with a valuable learning experience and we have kept these users in mind during design and development.
Design Approach
To build this applet, we used an iterative, prototyping approach to development. Corey began by creating the basic interface (main screen, buttons, etc.) and defining classes that would be used by the GUI, but had no actually code behind them. Haihua and Tom then each took turns developing the code behind each class and adding some additional buttons (Clear, Cancel, etc.) Once everyone had an initial turn at developing the baseline system, we then continued to iterate the source code through the group. Each member would test the existing applet, make design recommendations and then code anything needed to repair testing or design issues that they had discovered. During these design iterations each member would also add a couple new features such as sound, graphics, animated GIF files and so on. We ended up having 13 versions of the applet, with each member being responsible for at least 4 new versions each. Almost every piece of source code was written, edited or re-written be each member so we all had a hand in the finished product and it is difficult to give ‘ownership’ of a particular widget or module to just one person. Each member participated fully and equally in analysis, design, development, and testing. The resulting applet is truly the result of a team effort.
Design Implementation
The basic interface for our ATM Simulator can be seen below:
To create this interface, JPanel was used to create various panes that would contain logical groups of components. Various widgets were then used to build the GUI. Some examples are provided below
JButton: Deposit, Withdrawal, Transfer, Close Drawer, OK, Clear, Enter, Cancel and the entire number pad.
JCheckBox: Print Receipt
JTextArea: Main Screen
JTextField: Amount Box
JRadioButton (and Button Group): Checking, Savings
JMenuBar: Menu bar
Once the interface was designed, we had to set up the code behind it. We created an event listener and event handler to call the appropriate functions when an event occurred. For example, when someone presses deposit button, the routine deposit_pressed( ) needs to be called. A listing of the more significant procedures follows:
Name / Descriptiondisable_amount(); / Disable amount text box when appropriate
enableContainer(Container c, boolean bEnabled) / Enables container
run() / Starts the running clock on GUI
addPaneAmount() / Adds new pane to display
ddPaneAccountType() / Adds new pane to display
addButton(String label, ActionListener listener) / Adds new button to a pane
void OK_pressed() / Processes transaction when OK or Enter pressed
paintComponent(Graphics g) / Handles graphics display on GUI
Deposit_pressed() / Processes Depsoit transactions
Withdrawl_pressed() / Processes Withdrawl transactions
Transfer_pressed() / Processes Transfer transactions
Inquiry_pressed() / Processes Inquiry transactions
Clear_pressed() / Clears amount field
Drawer_pressed() / Closes user drawer
print_screen(String str) / Prints items to main screen
print_image(String str1, String str2) / Prints images to certain pane
initiate(String str) / Returns variables to original state
warnmsg(String str) / Write warning messages to designated area
void validate(String str) / Validate user input
getURL(String filename) / Displays an image file
Some other cool stuff to look for is the use of sound, the handling of events when certain buttons are disabled/enabled as necessary, the use of graphics and pictures, the running clock, the clickable help icon and the use of different mouse pointers.
User’s Guide
When you first open the applet, the number key pad and amount fields will be disabled. Your first task is to select a transaction type (i.e. Deposit, Withdrawal, Transfer, Inquiry).
Deposits
For this prototype applet, the first item you should select is Deposit so that you can put some money into an account. The other functions will return an error message if you do not have any funds in your accounts to Withdrawal or Transfer (though Inquiry will still work).
Once you select Deposit, the numeric key pad will be enabled and you will be prompted for an amount. You can enter this amount by typing directly in the amount text box or by clicking the numbers on the numeric keypad. You will also have to select the account type (Checking or Savings) by clicking the appropriate radio button just above the amount text box.
If you make an error while entering the amount, the Clear button can be used to reset the value of the text box. To cancel the transaction entirely and return to the beginning state, press the Cancel button. Notice the difference between Cancel and Clear.
Once you are satisfied with your amount, press the OK or Enter buttons to continue.
The drawer in the lower right hand corner will now open and you will be prompted to deposit your deposit envelope. When finished, click the Close Drawer button to close the drawer. Your transaction is now complete and a detailed message will be posted to the screen.
If you want a ‘hard copy’ receipt for this or any other transaction, be sure to check the Print Receipt checkbox before completing your transaction.
Withdrawal
If you select the Withdrawal transaction, the numeric key pad will be enabled and you will be prompted for an amount. You can enter this amount by typing directly in the amount text box or by clicking the numbers on the numeric keypad. You will also have to select the account type (Checking or Savings) by clicking the appropriate radio button just above the amount text box.
If you make an error while entering the amount, the Clear button can be used to reset the value of the text box. To cancel the transaction entirely and return to the beginning state, press the Cancel button. Notice the difference between Cancel and Clear.
Once you are satisfied with your amount, press the OK or Enter buttons to continue.
The drawer in the lower right hand corner will now open and your cash will be dispensed. When finished collecting your money, click the Close Drawer button to close the drawer. Your transaction is now complete and a detailed message will be posted to the screen.
If you want a ‘hard copy’ receipt for this or any other transaction, be sure to check the Print Receipt checkbox before completing your transaction.
Transfer
If you select the Transfer transaction, the numeric key pad will be enabled and you will be prompted for an amount to transfer. You can enter this amount by typing directly in the amount text box or by clicking the numbers on the numeric keypad. You will also have to select the account type (Checking or Savings) that the money will be transferred from by clicking the appropriate radio button just above the amount text box. The unselected account type will then be the destination for this transfer.
If you make an error while entering the amount, the Clear button can be used to reset the value of the text box. To cancel the transaction entirely and return to the beginning state, press the Cancel button. Notice the difference between Cancel and Clear.
Once you are satisfied with your amount, press the OK or Enter buttons to continue.
The money will be transferred and this action will be accompanied by an audible feedback. When your transaction is complete, a detailed message will be posted to the screen.
If you want a ‘hard copy’ receipt for this or any other transaction, be sure to check the Print Receipt checkbox before completing your transaction.
Inquiry
Selecting the Inquiry function will display all current account balances to the screen. If you want a ‘hard copy’ receipt for this or any other transaction, be sure to check the Print Receipt checkbox before completing your transaction.
Help and About
The following two icons are provided on the main title bar:
The icon on the left allows you to access the on-line help system if you run into trouble. The button on the right gives the information about the system version and the developers.