Array for counting from 1 to 100

Here's the assignment:

Write methods for the following:

a)Find and return the total sum of numbers stored in an ArrayList.

b)find and return the maximum number from the ArrayList.

c)Find and return the minimum number from the ArrayList.

d)Find and return the mean of all the numbers from the ArrayList.

Write a tester class that creates an ArrayList of numbers. Add numbers from 1 to 100 to the ArrayList. Call all the utility methods from your utility class on the ArrayList that you have created. Print the results obtained.

I don't know how to get the ArrayList to count.

here's my thoughts, but I don't know how to get it to work, it's messing up.

ArrayList<Integer> numbers = new ArrayList<Integer>();

{

for(int i=0; i<numbers.size(); i++)

{

numbers [i]=i+1;

}

Re: Array for counting from 1 to 100

Re: Array for counting from 1 to 100

Like how would I do this in code though, I don't understand Arrays at all

Re: Array for counting from 1 to 100

Quote:

Originally Posted by

**Magic8ballfollower** Like how would I do this in code though, I don't understand Arrays at all

We're not going to do your work for you. You've gotten a good suggestion and a link to the tutorials. I suggest you **read** and study the tutorial so you do understand ArrayLists, and then come back with your new code if you get stuck.

Re: Array for counting from 1 to 100

the "help" he gave is a link to a crappy site that isn't helping at all, and his reply didn't answer or corrrect anything I've already posted

Re: Array for counting from 1 to 100

Quote:

Originally Posted by

**Magic8ballfollower** the "help" he gave is a link to a crappy site that isn't helping at all, and his reply didn't answer or corrrect anything I've already posted

That "crappy" site is where many of us, myself included, learned how to code in Java. The more you use the site, the less crappy and more useful it will become and the better coder you will be. Also, you really didn't ask any direct question in your first post. It isn't really our job to correct your code, but to try guide you so that you can learn about the concepts needed to correct it yourself. Otherwise we would be cheating you out of learning something well.