0

Help in this

You are an assistant on a TV show where celebrities are dancing and 4 judges evaluate their performance and give them a score between 1 and 10. The program you are given takes the scores as input. Complete the method to take them as parameters, then calculate and return the average score. Sample Input 6.0 4.0 5.0 3.0 Sample Output 4.5

14th Mar 2021, 5:51 PM
hossin Chorfi
hossin Chorfi - avatar
7 odpowiedzi
+ 5
hossin Chorfi try it your self first before asking here . If you have any queries/doubts while you solving then ask in this section . HINT: if you know average formula then your problem solve easily . I hope u know that. If you don't know that formula Here it's for u .. To calculate average of numbers is equal to sum of all values divided by total number of values.
14th Mar 2021, 6:21 PM
NavyaSri
NavyaSri - avatar
0
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, score2, score3, score4); System.out.println(avgScore); } //create your method here public static doublei getAverageScore(double x,double y,double z,double t) { avgScore=(x+ y+z+t )/4; return avgScore ; } } This is my code but when i run it he tell me cannot find symbols
14th Mar 2021, 8:35 PM
hossin Chorfi
hossin Chorfi - avatar
0
You have written "doublei" in getAverageScore
14th Mar 2021, 8:38 PM
Ciro Pellegrino
Ciro Pellegrino - avatar
0
In the getAverageScore you use a variabile avgScore without a declaration type Write double before the name of the variable
14th Mar 2021, 8:43 PM
Ciro Pellegrino
Ciro Pellegrino - avatar
0
Thank you
14th Mar 2021, 8:52 PM
hossin Chorfi
hossin Chorfi - avatar
0
import java.util.Scanner; public class Main { // calculate the avarage, score will be given from four judges to evaluate performance the participants double avarage(double score1, double score2, double score3, double score4){ double mean = (score4+score3+score2+score1)/4; return mean; } public static void main(String[] args) { Scanner score = new Scanner(System.in); double judge1 = score.nextDouble(); double judge2 = score.nextDouble(); double judge3 = score.nextDouble(); double judge4 = score.nextDouble(); double Score = new Main().avarage(judge1, judge2, judge3, judge4); System.out.println("The max number is " + Score); } }
6th Nov 2021, 7:48 PM
Mohammad Jamal Mahmoud Al Jadallah
Mohammad Jamal Mahmoud Al Jadallah - avatar
0
//COMPLETE WITH THIS public static double getAverageScore( double x, double y, double w, double z) { return (x+y+w+z)/4; }
3rd Mar 2022, 1:01 PM
Irini Gkouzioti