Re: Math.min not working.

What do you mean when you say it doesn't work?

What happened when you stepped through this with a debugger, or at least added some print statements, to figure out what's going on?

Re: Math.min not working.

Ok, here are a few observations.

Don't assign min and max until "after" you populate the array. Otherwise, you assign both a default double value which is 0. That is why your program is not working correctly.

Also, a few changes could make it shorter.

- Assign sum to be equal to array[0] (after the array is filled of course).
- Then you can use one loop for everything, starting at x = 1.
- Then calculate average outside the loop
- You already have a variable named NUMITEMS. So when taking the average, divide by that instead of an explicit 10.

Jim

Re: Math.min not working.

Thanks Jim! It is fixed now.

Re: Math.min not working.

I also noticed that you are calculating average but not printing it out.

Jim

Re: Math.min not working.

Yeah, but as I said in the 1st line of the thread, I'll add it later.