I am working on an assignment for a class I'm taking. Currently, I have a while loop which takes data from the user through JOptionPane. I am suppose to use a sentinel value (q or Q) to tell the loop to stop. I have my if statement argument working, but I am not sure whether there is a method to turn off JOptionPane. What would be a good way to do this?
/*
Takes user grades until the user types Q.
This loop takes any integer value.
If the user types Q (or q), the loop
stops.
*/
while(!input.equalsIgnoreCase("Q"))
{
grader.addGrade(gradeInput);
JOptionPane.showInputDialog(informativeMessage);
}
/*
If the user types Q (or q), the loop
stops. The dialog then disappears.
*/
if(input.equalsIgnoreCase("Q"))
{
//JOptionPane closes
}