//Member Login
public static boolean memberLogin(){
int memberPassword = 123;
boolean password = false;
int confirm = JOptionPane.showConfirmDialog(null, "Are You A Member? ", "Member Confirmation", JOptionPane.YES_NO_OPTION);
do{
while(confirm == JOptionPane.YES_OPTION && password == false){
String tempCurrentPassword = JOptionPane.showInputDialog(null, "Please Enter Your Password", "Default Password = 123");
int currentPassword = Integer.parseInt(tempCurrentPassword);
if(currentPassword == memberPassword){
JOptionPane.showMessageDialog(null, "You've Entered Correctly!", "Login Successful", JOptionPane.INFORMATION_MESSAGE);
password = true;
}
else{
JOptionPane.showMessageDialog(null, "You've Entered Wrongly!", "Login Failed", JOptionPane.ERROR_MESSAGE);
password = false;
}
}
if(confirm == JOptionPane.NO_OPTION)
memberRegister(memberPassword);
}while(password == false);
return password;
}
//Member Registration
public static void memberRegister(int memberPassword){
String tempPass = JOptionPane.showInputDialog(null, "Enter Your Password", "Enter Your Password, Integer Type Only");
memberPassword = Integer.parseInt(tempPass);
}
is these two method, i am trying to ask the user whether he is member or not.
it is run correctly if user choose YES, but if user choose NO, it will keep run and run and run memberRegister() method. Where's my mistake?