QUOTE(Amadeus @ 12 Jul, 2007 - 07:46 AM)

Can you specify the following:
1. What do you wish the program to do?
2. What is it actually doing that does not conform to point 1?
3. Any error messages you are receiving?
4. The complete code (or is this it? At the very least, you are missing both opening and closing braces in crucial spots that would prevent successful implementation).
Thanks
CODE
import javax.swing.*;
public class ATMAccess {
public static void main(String[] args) {
String firstCode = "0101", secondCode = "0202";
int x = 0101;
int y = 0202;
int accessCode = Integer.parseInt(JOptionPane.showInputDialog("Input access code"));
if ( (accessCode==x) || (accessCode==y) ){
int withdrawal = Integer.parseInt(JOptionPane.showInputDialog("Enter amount to withdraw"));
JOptionPane.showMessageDialog(null, "Withdrawal authorized");
}
JOptionPane.showMessageDialog(null, "Invalid access code");
String option = "Do you want to try another code?";
int tryAgain = JOptionPane.showConfirmDialog(null, option);
if (tryAgain == JOptionPane.YES_OPTION){
int accessCode2 = Integer.parseInt(JOptionPane.showInputDialog("Input access code"));
}
}
}
(That is my incompleted code above)
Sorry about that. I was tired when I wrote this and I didn't write out the whole problem.
The part that I needed help on was the if statement. I'm trying to get my program to read that if the acces code entered is either 0101 (the x variable) or 0202 (the y variable) then it will display the withdrawal message below it. But so far, if I enter 0101 or 0202, it will think that the access code is wrong and skip down to the message that tells me that it is an invalid access code. When 0101 or 0202 is used for the access code, I want it to disply "Enter amount to withdraw". Apparently == isn't working. What else can I do?
1. I want the program to act as an ATM machine.
2. Point 1? I don't understand...What is point 1?
3. No error messages.
4. incomplete code.
This post has been edited by ravensrock86: 12 Jul, 2007 - 07:37 AM