- 1
Who can help pls
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner read = new Scanner(System.in); double score1 = read.nextDouble(); double score2 = read.nextDouble(); double score3 = read.nextDouble(); double score4 = read.nextDouble(); double avgScore = getAverageScore(score1 2.2, score2 1.2, score3 2.6, score4 3.6); System.out.println(avgScore); } //create your method here public static double getAverageScore(int score1 ,int score2 ,int score3 ,int score4 ) { if (score1 > score2 && score3 >score4 ) { return score1 ; } else { return score4 ; } } }
2 Respostas
+ 1
Make sure you tag the appropriate language and state the task as well as the errors you are getting.
Also, I'm not sure if this is relevant since you did not state the task, but just based off the method name, it doesn't look like you're averaging the score. You just have if statements.
Remember that averaging is when you add all scores and then divide by the amount of scores there are. I'm not sure what the if statements are there for.
+ 1
MR KINGSHOW reset the code (using the 3 dots in the top right corner of the code box). You've changed too many things that you don't need to.
Look at:
public static double getAverageScore()
What needs to go into there? And what type do those values need to be? They shouldn't be Strings or Booleans, that's for sure.
Justice told you how to calculate the average, and I'm fairly certain that's the tip in the task.
So you need to "return" all those scores divided by 4.
Hope it helps!