Sentinel value: Can be used for indicating the end of a data set
0 or -1 make poor sentinels; better use Q
System.out.print("Enter value, Q to quit: "); String input = in.next(); if (input.equalsIgnoreCase("Q")) We are done
else
{
double x = Double.parseDouble(input);
. . .
}