HW4 : Bruin Bank
Submit
submit ATM.java
You can assume that the grader use normal input for the main function. So
you don't have to do error handling or make sure there are 2 inputs.
2 input, one is name,one is a number will be used for the main.
The font I used can't be showed up properly by the computers in the lab.
Don't worry about it.
There is a bug in my program, if you withdraw the same amount equal to the
balance, then "there is not enough money"
message shows up. Don't worry about the bug.
You can download the program here .
You can get hints here .
To run the program:
- use DOS to go to the folder contains the file bank.jar
- type
java -cp bank.jar bank.Main name
balance.
Exampe :
java -cp bank.jar Charles 1000
The program should show up.
You can also run
java -cp bank.jar bank.Main Amy 20000 for other example.
Here is the screen shot :

In below are points you should pay attention to
- You should have only one file name
ATM.java
- You can get part of the code ATM.java. The partial program
can be compiled and executed
- You can make any changes you like to the file. You can also change the
words of the messages
- ATM.java should contain the main program. such that
java ATM name balance
shows up the ATM machine with given name and balance.
- move the mouse on different components will highlight the components.
You can use a different color sets.
- You can choose
withdraw,deposit, balance radio buttons
- press on the number or type in the text field to enter the amount.
- press return at the text field or press the proceed button will update the
new balance.
- press cancel button to cancel the action.
- pay attention to the fact that sometimes the text field is highlighted. Use
selectAll() and requestFocus(). TAs will talk about
these during TA sections.
- try to
- enter negative number
- enter non-number
- withdraw money more than the balance
to see what happens
- press exit button to quit the program. TAs will talk about it.
- the text area is not editable
- I set different fonts for label and text area. You can go to microsoft word,
and try to change font. You can get list of available fonts on your computer.
I use "Copperplate Gothic Bold" for the logoLabel and
"OCR A Extended" for the text area. You can use any fonts you like but you
have to change the font for the label and the text area.
- more hints will be given in the TA sections or in the webpage.
- You should begin the file with the pledge, refer to hw3 for the format.
- Please add few lines each time to your file and compile it. Don't write too
many codes without compiling and testing!!!
Solution
ATM.java