I just want to loop this code until a proper answer in entered, can someone please teach me how to do so?
//enter marital status
{Scanner keyboard = new Scanner(System.in);
System.out.println("Please enter your Marital Status folowing the numbers given");
System.out.println("0 = Single");
System.out.println("1 = Married Filing Jointly or Qualifying Widow(er)");
System.out.println("2 = Married Filing Seperately");
System.out.println("3 = Head of Household");
status = keyboard.nextInt();
{
if (status == 0) {
System.out.println("You have selected single.");}
else if (status == 1) {System.out.println("You have selected Married Filing Seperately or Qualifying Widoe(er).");}
else if (status == 2) {System.out.println("You have selected Married Filing Seperatey");}
else if (status == 3) {System.out.println("You have selected Head of Household");}
else if (status > 3) {System.out.println("Invalid selection"); System.exit(0);}
}