In: Computer Science
Using a (GUI interface), write a Java program that simulates an ATM machine with the following options menu:
"Welcome"
1. Deposit to account
2. Withdraw
3. Exit
Note: Could you plz go through this code and let me
know if u need any changes in this.Thank You
=================================
// AccountTest.java
import javax.swing.JOptionPane;
public class AccountTest {
public static void main(String[] args) {
int choice;
double amt=0.0;
Account acc=new Account();
while (true) {
choice =
Integer.parseInt(JOptionPane.showInputDialog("\"Welcome\"\n1.Deposit
to account\n2.Withdraw\n3.Exit\nPlease enter the first number:
"));
switch (choice)
{
case 1: {
amt=Double.parseDouble(JOptionPane.showInputDialog("Enter Amount to
despoit:$" ));
acc.deposit(amt);
JOptionPane.showMessageDialog(null,"Your New Balance
:$"+acc.getBalance());
continue;
}
case 2: {
amt=Double.parseDouble(JOptionPane.showInputDialog("Enter Amount to
withdraw:$" ));
boolean
b=acc.withdraw(amt);
if(!b)
{
JOptionPane.showMessageDialog(null,"Insufficient
Funds");
}
else
{
JOptionPane.showMessageDialog(null,"Your New
Balance :$"+acc.getBalance());
}
continue;
}
case 3: {
break;
}
default: {
JOptionPane.showMessageDialog(null,"** Invalid
Choice **");
continue;
}
}
break;
}
}
}
==================================================
Output:
=====================Could you plz rate me well.Thank You