New course! Every coder should learn Generative AI!
Try a free lesson- 1
Method Return Types. So you think you can dance.
How do I complete the method and take the scores as parameters then calculate and return the average for the following code: https://code.sololearn.com/cJKnPKMhg17i/?ref=app
4 Answers
+ 2
Remove line 19. It's unreachable code after a return statement.
Optionally, you can get rid of the x and y variables too if you just simply return the calculation.
return (a + b + c + d) / 4.0;
Otherwise, your code is syntaxually correct.
+ 1
Your getAverageScore() method needs to accept 4 parameters of type double then return the average (add them together and divide by 4.0) of the arguments passed to the method as a double.
+ 1
Thank you so much ChaoticDawg I am new to coding but im starting to understand a lot more. For instance you just taught me there is no need for a System.out.println() if there is a return statement.
0
ChaoticDawg I know what to do in theory and in my head. I know how to find the average. I just dont understand the syntax of how to code it and in what order. This is what I came up with thus far:
https://code.sololearn.com/cuRnzECFQqX9/?ref=app