I don't see what the issue is, because the code should accept the length of the array of the array as a parameter and test it up to that many times.

Any additional help would be great, thanks!

February 21st, 2011, 11:38 PM

destructobob

Re: Array List Help - Can't find where problem is!!

Yes, I flipped that. But now I'm struggling to do these for loops. I need them to run through the array x number of times, x being the int parameter going into the method runExperimentManyTimes. I need to be able to check the color of however many birds come into the method with the x parameter. But I need to access the results array only between 0 and 10. Putting i from the for loop into the for results parameter is causing the error when the loop tries to run more than 10 times, as it has to when the experiment is run 100000 times.

Any ideas?

February 22nd, 2011, 12:04 AM

helloworld922

Re: Array List Help - Can't find where problem is!!

edit: nvm, I didn't look closely at the code. Editing and coming up with the new solution now :P

edit2: here's the new solution:

You shouldn't be summing up the average while running the experiment x number of times, but rather at the end. Same thing goes for the finding which bird count came up the most often.

Code Java:

// this goes after you've run the experiment x number of timesfor(int i =0; i <=10;++i){// TODO: sum up the total number of red birds seen// TODO: find the max index in results}// TODO: using the sum, calculate the average