You are assuming that user has to type in a number and hit return, like this:
20 <return>
30 <return>
40 <return>
And you are trying to figure out a. how to provide them with repetitive prompts, and b. how to provide them a way to break out of the prompt.
Rather than approach this in a linear/serial fashion you might want to approach this way. Have the user input their series of numbers at one input, like this:
20 30 40 <return>
This removes the requirement of trying to figure out a prompt loop AND it makes it easier for the user to input a series of numbers.
Now the question is how to take input, which is "20 30 40", and figure out how to store it. I'm going to let you figure out how to get the input but let us assume that my example above is stored in a variable as follows:
String numSeries = "20 30 40";
I can take this string a create an Array using the Split method. The Split method basically looks for places to separate the whole string into pieces. Here is how it would look
String numSeriesArray[] = numSeries.Split(" ");
The "[]" on numSeriesArray tells Java you want to create an array.
The ".Split" on numSeries is a String method to split up the input on some delimiter.
The "(" ")" is the delimiter, which in this case is a space.
The resulting array would be as follows:
numSeriesArray[0] = 20
numSeriesArray[1] = 30
numSeriesArray[2] = 40
You can find some more information about this, it's where I dug it up, at:
http://www.artima.co...=1&thread=96632