0

public static String checkStatus(String status) { while((status != "s" || status != "S" || status != "m" || status !=

//this line is in the main program
marital = checkStatus(marital);

//this is a method that keep asking for s or m if user input is not s or m
public static String checkStatus(String status)
 {
  while(status != "s" || status != "S" || status != "m" || status != "M")
  {
   status = JOptionPane.showInputDialog(null, "Please enter M or S for marital status: ");

  }
  return status;
 }

"M")) { status = JOptionPane.showInputDialog(null, "Please enter M or S for marital status: ");

    }
    return status;
}

//I keep getting a infinite loop that ask for m or s

Vince
  • 1

0 Answers0