Ask Experts Questions for FREE Help !
Ask
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #1

    Nov 9, 2007, 01:09 PM
    i don't understand what's wrong,
    anyhelp would be great thank; OK then I have my code:

    class MySums // to calculate the average of three numbers,
    //one dealing with integers, the other with double
    {
    public static void main ( String [] args)

    {

    averageI(23, 45, 89);


    }
    public static int averageI (int num1, int num2, int num3)
    {

    int num4 = ((num1 + num2 + num3)/3);

    return num4;

    // calcualte the average of the three numbers
    // return the average

    }

    public static void averageI (double Num1, double Num2, double Num3)
    {

    double Num4 = ((Num1 + Num2 + Num3)/3);

    return Num4;

    System.out.println("integer average is " + averageI(23, 45, 89));
    }
    }

    its suppost to return the values Num4 and num4, but it says

    'cannot return a value from method whose result type is void, return Num4'
    ^(this is supposed to go under the N of Num4)

    I don't know what the problem means so I don't know how to correct it.
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #2

    Nov 9, 2007, 01:26 PM
    Any suggestions?
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #3

    Nov 9, 2007, 01:43 PM
    At all?
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #4

    Nov 9, 2007, 06:14 PM
    Somebody?
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #5

    Nov 10, 2007, 09:56 AM
    Anybody?
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #6

    Nov 10, 2007, 02:38 PM
    Hello...
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #7

    Nov 11, 2007, 02:19 PM
    Please...
    qcumber's Avatar
    qcumber Posts: 5, Reputation: 1
    New Member
     
    #8

    Nov 14, 2007, 09:22 PM
    Your static method... instead of

    Public static void etc etc... you should change it to include a return type... for example,

    Public static int or public static double.. etc etc
    albear's Avatar
    albear Posts: 1,594, Reputation: 222
    Ultra Member
     
    #9

    Nov 20, 2007, 02:42 PM
    Thank you, it was that

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search


Check out some similar questions!

Don't know what's wrong with me [ 52 Answers ]

I'm having trouble with everything in my life if anyone cares post anything on this cause I'm probably going to kill myself if there's no one who will care if I die

I don't know what's wrong and I'm worried [ 4 Answers ]

I am 16 and I have been having periods since I was 12 but never regular always have been on and off, this year I have only had three. I went for a ultrasound and they said they saw nothing wrong.I am not over weight or underweight I weigh about 8stone, so I am boggled as to what it could be. I have...

I don't Know what's Wrong With Me. [ 10 Answers ]

My name is Mandie, lately I just feel sad, well BORED! I can watch t.v. play with my dogs, get on the computer. But I just feel yukky. What do I do? :(

My dog looks sick but I don't know what's wrong with it [ 1 Answers ]

OK my dog looks seriosly sick. She is still enegetic but all around her eyes is red like a vained poped but it has been likea month and I thought it might be a viral infection what do you thinks going on with her she is a black lab so if it is a gentic thing OK. Please answer .thnx

Help me to understand what's going on [ 3 Answers ]

Almost a year ago I found that my wife had an e-mail romance with her high school boyfriend and was planning to visit him. I confronted her and she admitted it. We were on a brink of divorce. But we found strength to gradually rebuild our marriage which was falling apart at that time. Now things...


View more questions Search