i dont know that my error is, my code for balance is not working properly and im having a problem with my if else statements, they say i lack this "{" but i dont know where
to put it
{
/**
* @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";
float balance= 0;
int deposit = 0;
int withdraw= 0;
int bal = 0;
int wht = 0;
int ans = 0;
int trans = 0;
if(a.equalsIgnoreCase(B))
{
JOptionPane.showMessageDialog(null, "Your Balance is: ","BALANCE INQUIRY"+ balance,JOptionPane.PLAIN_MESSAGE );
ans=JOptionPane.showConfirmDialog(null, "Would you like to generate bank slip?","Generate Bank Slip",JOptionPane.YES_NO_OPTION);
do { 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));
}
}
}while (ans == 0); // yes
JOptionPane.showMessageDialog(null, "BALANCE INQUIRY \n AMOUNT BALANCE: "+ balance+ "\nPrinting Bank slip.....");
}
}
/*
else if (a.equalsIgnoreCase(D))
{
int dep =Integer.parseInt(JOptionPane.showInputDialog (null,"Enter Your Deposit Amount" ));
balance = dep - wht;
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 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, "DEPOSIT INQUIRY \n AMOUNT DEPOSIT: "+ dep+ "\nPrinting Bank slip.....");
}
}
else if (a.equalsIgnoreCase(W))
wht= Integer.parseInt(JOptionPane.showInputDialog(null," Enter the Withdrawal Amount:"));
if (balance < wht){
JOptionPane.showMessageDialog(null, "Insufficient Amount");
}
else if (balance >= wht){
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.....");
}
*/
}