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>
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.
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);
> 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?
"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.
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.
<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)";
> 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.