Hi i was just wondering if anyone had any solutions to changing this switch statement to an IF ELSE statement, solutions would be helpful.
switch (option) {
// add person
case 1:
addPerson();
// shows the person added
JOptionPane.showMessageDialog(null, "\nThe following person has been added: \n");
printPerson(numberOfPersons - 1);
break;
// search person
case 2:
searchPerson();
break;
// prints all the people listed
case 3:
printAllPersons();
break;
// quits the program
case 4:
JOptionPane.showMessageDialog(null, "Program terminated...\nHave a nice day =]");
// quit
System.exit(0);
break;
default:
// warn user that something has gone wrong
JOptionPane.showMessageDialog(null, "You have entered invalid information mate! Please try again.");
break;
}
}
}