Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!

# Array Help

Jefferey Stevens
Greenhorn
Posts: 7
I'm trying to use the JOptionPane and a while loop to input two lists ( so two arrays?) of 32 numbers, which are made up by the user. The data cannot be sorted before it is entered into the arrays. It is supposed to ignore the numbers -1000 and 1000. I need to be able to print the average high and average low of the numbers and lows or highs position in order with the day( the index of the array?). I'm new at this so any help is appreciated. Here's what I have so far.

Jeff Verdegan
Bartender
Posts: 6109
6
You need to break your problem down into very small pieces, and tackle the pieces one at a time. If you get stuck on one of the pieces, post what you tried so far and TellTheDetails(←click) about what in particular is giving you trouble.

Jefferey Stevens
Greenhorn
Posts: 7
Okay, I'm not sure how to use JOptionPane to input two lists of 32 numbers in the Load method. I don't know how to start.

Paul Clapham
Sheriff
Posts: 21443
33
So, again breaking that task down into smaller pieces, would that mean that you don't know how to use a JOptionPane to input something? Or is it the inputting of a number that's giving you the problem? Or inputting 32 numbers?

Jefferey Stevens
Greenhorn
Posts: 7
Paul Clapham wrote:So, again breaking that task down into smaller pieces, would that mean that you don't know how to use a JOptionPane to input something? Or is it the inputting of a number that's giving you the problem? Or inputting 32 numbers?

All of it :[

JOptionPane.showInputDialogue?
I really have no idea how to go about it.

Salman Mushtaq
Greenhorn
Posts: 27
First in Init method you initialize i with 1 , please initialize it with 0 . . .
Secondly JOptionPane only give and take String
like
String input = JOPtionPane.showInputDialog("Enter String");

JOptionPane.showMessageDialog(null , "input");

if you use input string as a integer yoy should use parsing ,,.. like int in = Integer.parseInt(input);

moreover you use java documentations for more help