Java Reference
In-Depth Information
66
else if
(command.equalsIgnoreCase(
ÐBÑ
))
67 {
68 System.out.print(
ÐAmount: Ñ
);
69
double
amount =
in.nextDouble();
70 theATM.withdraw(amount);
71 theATM.back();
72 }
73
else if
(command.equalsIgnoreCase(
ÐCÑ
))
74 theATM.back();
75
else
76 System.out.println(
ÐIllegal
input!Ñ
);
77 }
78 }
79 }
80 }
570
571
Output
Enter account number:
1
Enter PIN:
1234
A=Checking, B=Savings, C=Quit:
A
Balance=0.0
A=Deposit, B=Withdrawal, C=Cancel:
A
Amount:
1000
A=Checking, B=Savings, C=Quit:
C
. . .
Here are the user interface classes for the GUI version of the user interface.
ch12/atm/ATMViewer.java
1
import
java.io.IOException;
2
import
javax.swing.JFrame;
3
import
javax.swing.JOptionPane;
4
5 /**
6
A graphical simulation of an automatic teller machine.
7 */
8
public class
ATMViewer