why is that some of the codes that i put in are not being implemented when i run this?? i mea, the cycle of my program doesnt seem to be flowing the way i want it to be, come take a look :(
{
/**
* @param args
*/
public static void main(String[] args) {
String a =(JOptionPane.showInputDialog(null, "Automatic Teller Machine\n [B] Balance Inquiry\n [D]Deposit\n [W] Withdrawal\n [Q] Quit\n Select you Options: ","Automatic Teller Machine",JOptionPane.PLAIN_MESSAGE));
String B= "B";
String D="D";
String W="W";
String Q="Q";
int balance= 0;
int deposit = 0;
int withdraw= 0;
double bal = 0;
int ans = 0;
int trans = 0;
do {
if(a.equalsIgnoreCase(B))
{
JOptionPane.showMessageDialog(null, "Your Balance is: ","BALANCE INQUIRY"+ bal,JOptionPane.PLAIN_MESSAGE );
bal=bal+deposit;
ans=JOptionPane.showConfirmDialog(null, "Would you like to generate bank slip?","Generate Bank Slip",JOptionPane.YES_NO_OPTION);
if (ans == 1);
{ //no
trans =JOptionPane.showConfirmDialog(null,"Would You Like Another Transaction?","Another Transaction",JOptionPane.YES_NO_OPTION);
if (trans == 1)
{
JOptionPane.showMessageDialog(null, "Thanks For Using My Program!!");
System.exit(0);
}
else if (trans == 0)
{
String b =(JOptionPane.showInputDialog(null, "Automatic Teller Machine\n [B] Balance Inquiry\n [D]Deposit\n [W] Withdrawal\n [Q] Quit\n Select you Options: ","Automatic Teller Machine",JOptionPane.PLAIN_MESSAGE));
}
else if (ans == 0); // yes
{ JOptionPane.showMessageDialog(null, "BALANCE INQUIRY \n AMOUNT BALANCE: "+ bal+ "\nPrinting Bank slip.....");
}
}
}
else if (a.equalsIgnoreCase(D))
{
int dep =Integer.parseInt(JOptionPane.showInputDialog (null,"Enter Your Deposit Amount" ));
if (ans == 1);
{ //no
trans =JOptionPane.showConfirmDialog(null,"Would You Like Another Transaction?","Another Transaction",JOptionPane.YES_NO_OPTION);
if (trans == 1)
{
JOptionPane.showMessageDialog(null, "Thanks For Using My Program!!");
System.exit(0);
}
else if (trans == 0)
{
String c =(JOptionPane.showInputDialog(null, "Automatic Teller Machine\n [B] Balance Inquiry\n [D]Deposit\n [W] Withdrawal\n [Q] Quit\n Select you Options: ","Automatic Teller Machine",JOptionPane.PLAIN_MESSAGE));
}
else if (ans == 0); // yes
{ JOptionPane.showMessageDialog(null, "BALANCE INQUIRY \n AMOUNT BALANCE: "+ deposit+ "\nPrinting Bank slip.....");
}
}
}
else if (a.equalsIgnoreCase(W))
{
int wht= Integer.parseInt(JOptionPane.showInputDialog(null," Enter the Withdrawal Amount:"));
}
ans=JOptionPane.showConfirmDialog(null, "Would you like to generate bank slip?","Generate Bank Slip",JOptionPane.YES_NO_OPTION);
if (ans == 1)
{ //no
JOptionPane.showConfirmDialog(null,"Would You Like Another Transaction?","Another Transaction",JOptionPane.YES_NO_OPTION);
if (trans == 1)
{
JOptionPane.showMessageDialog(null, "Thanks For Using My Program!!");
}
else if (trans == 0)
{
String d =(JOptionPane.showInputDialog(null, "Automatic Teller Machine\n [B] Balance Inquiry\n [D]Deposit\n [W] Withdrawal\n [Q] Quit\n Select you Options: ","Automatic Teller Machine",JOptionPane.PLAIN_MESSAGE));
}
else if (ans == 0)
{ // yes
JOptionPane.showMessageDialog(null, "DEPOSIT INQUIRY \n AMOUNT DEPOSIT: "+ withdraw+ "\nPrinting Bank slip.....");
}
}
} while (a == Q);
}}
some of the JOptions are repeating when its not suppose to be