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

a few remarks:
since this is about the same application as your other thread, you may want to keep the questions in that thread.
also, you are comparing values of String objects using '==' which you shouldn't do.
on a few places, you already use equals(IgnoreCase) which is the correct way, but you don't do it everywhere.

also: you forgot to provide us with essential information. what exactly is your code doing, and what did you expect it to do? be specific, what parts are being repeated and what did you want to be performed?

a few remarks:
since this is about the same application as your other thread, you may want to keep the questions in that thread.
also, you are comparing values of String objects using '==' which you shouldn't do.
on a few places, you already use equals(IgnoreCase) which is the correct way, but you don't do it everywhere.

also: you forgot to provide us with essential information. what exactly is your code doing, and what did you expect it to do? be specific, what parts are being repeated and what did you want to be performed?

i want to delete this thread because i asked the wrong question here but i dont know how! :)

just close the thread, and add a reference to the other one if it's still an issue

just close the thread, and add a reference to the other one if it's still an issue

how do i close it? there is no tab here saying close..should i just mark it as solved?

you could do that, yes

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.