how do you sum a [5] [7] multi array?

I have to create a method to find the average of 35 integers in an array. What's the easiest way to do it? No code, because I want to do it my self first. I've been attempting to do it for a few hours now to no avail. I need hints.
[247 byte] By [mrb62a] at [2007-11-27 7:28:59]
# 1
Use a nested loop to add all of the numbers, then divide the result by the number of entries in the array.Hope that helps.Joe
Joe_ha at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 2
Nested for loops.
floundera at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 3

What's wrong with this method? It won't compile. Giving me 4 errors that I just can't seem to correct. Could not figure out the nested for loop thing. Enhanced seemed simpler.

<html>

//get Class Mean

public double getMean(int allGrades[]);

{

int total = 0;

for (int grade : allGrades)

total += grade;

return (double)total/allGrades.length;

System.out.print("The class Mean is", getMean);

}

</html>

mrb62a at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 4

Usually when you get errors, you post them here so we don't have to read your mind. I can see two errors. You cannot have any code after a return statement. The return means go back to where this method was called from immediately. If it does that, how is it supposed to execute any lines after the return? Also the print method takes only a single parameter, you have two.

floundera at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 5
I'm a newbie. How am I supposed to know what any of this stuff means? Ok, no code after return statements, lesson learned. What two parameters in the print statement?I hate programming
mrb62a at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 6
> > I hate programmingThen quit.
cotton.ma at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 7
print("abc", xyz) is wrong because you've specified two parameters--"abc" and xyz. If you want to concatenate those two together into a single string that will form print's single argument, then print("abc" + xyz)
jverda at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 8

System.out.print("The class Mean is", getMean);

Here the String "The class Mean is" is one parameter and the variable getMean is a second parameter. You should know all about what parameters are (maybe you were told they were arguments) and how to call methods.

Perhaps you want this instead:

System.out.print("The class Mean is " + getMean);

floundera at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 9
My last class buddy boy and i'm thru with my BS.I hate programming
mrb62a at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 10
> My last class buddy boy and i'm thru with my BS.> > I hate programmingAnd this is relevant because...?
jverda at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 11
> My last class buddy boy and i'm thru with my BS.> > I hate programmingSo then quit and go away.
cotton.ma at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 12
Actually I don't know a parameter from a parakeet when it comes to programming. This stuff just will not stick in my brain no matter how hard or how much time I spend on it. I appreciate your help though.
mrb62a at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 13
If you're not helping then why are you responding? You must be young.
mrb62a at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 14

> Actually I don't know a parameter from a parakeet

> when it comes to programming. This stuff just will

> not stick in my brain no matter how hard or how much

> time I spend on it. I appreciate your help though.

Do you understand now, or are you still confused?

jverda at 2007-7-12 19:09:09 > top of Java-index,Java Essentials,New To Java...
# 15
Looks like they have changed the forum software. Only 10 posts per page now.
floundera at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 16
> Looks like they have changed the forum software. Only> 10 posts per page now.No. The same trick that screwed with your account did that.
cotton.ma at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 17
Yeah I just read your other reply.
floundera at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 18
Just wow.
Joe_ha at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 19
> If you're not helping then why are you responding?Because I don't see the point in anyone wasting time helping you. You hate programming. So quit. And stop wasting people's time.
cotton.ma at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 20
Like I said, when I'm done with this degree I'll never attempt to program again. Stop wasting your time posting yungsta.
mrb62a at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 21

"Do you understand now, or are you still confused?"

I'll always be confused with programming but I have to get thru this class. I'm glad to see some are willing to help us who don't know this stuff. For those that aren't, well you know...

My program still won't compile but I'll get thru it somehow I hope. I understand the error messages but I just can't come up with valid solutions. I'm trying to do it on my own but it's not working out. Lots of trial ,error, and research.

mrb62a at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 22
If you remain stuck, post your current code and the exact, complete error message.If it's still the same as the original, you've already been given the answer, so I'm not sure what you're still having trouble with.
jverda at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 23

Let me give a good bit of advice, cotton has a lot more respect around here than you do. So if you want to continue getting the help you so desperately need, then perhaps you can curtail your personal feud. All you will achieve is pissing people off and no more help will come your way. This is in no way is in defense of cotton. I would say the same if you were arguing with anybody. Just shut up and concentrate on your work.

floundera at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 24

<html>

//get Class Mean

public double getMean(int allGrades[]);

{

int total = 0;

for (int grade : allGrades)

total += grade;

return (double)total/allGrades.length;

System.out.print("The class Mean is", getMean);

}

</html>

hello

first of all I don't really know in what language is this but I have some tips

you are trying to add numbers from a 2Dimensional array

and your method takes a one dimensional array as an argument so you might wanna fix that

e.g. getMean(int allGrades[ ][ ]) " and no semicolon if this is java"

two you have to take the print statment somewhere outside the method body, probably the main method is a good place to put it in" again I don't really know the structure of your code and the language neither"

after that when you call the method getMean you'll have to provide it with some argument

e.g.

System.out.println("Total is"+getMeant(some2DArray)";

javasyua at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 25
Or perhapsSystem.out.println("Total is "+getMean(some2DArray));
floundera at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 26
> If you're not helping then why are you responding?> You must be young.How does responding to a thread relate to one's age? If I repond to your thread, that means I'm young? I hope I can really get younger by replying to your thread.
Jensona at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 27
> I hope I can really get younger by replying to your thread.Rofl, but seconded.
thomas.behra at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 28
ok, ill start on it right away.please provide your full name, and the name of the course, name of the professor so i may put it in header comments.i think i should be able to do it in under an hour, please respond fast
mkoryaka at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...
# 29

> If you're not helping then why are you responding?

> You must be young.

>How does responding to a thread relate to one's age? If I repond to your thread, that means I'm young? I hope I can really get younger by replying to your thread.<

I was responding to some idiot who told me to quit and leave the forum just because I displayed frustration with programming. He offered no help , just a smart aleck comment.

mrb62a at 2007-7-21 22:15:20 > top of Java-index,Java Essentials,New To Java...