0
Help in this practice
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
7 Respostas
+ 3
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);
}
//Please Subscribe to My Youtube Channel
//Channel Name: Fazal Tuts4U
public static double getAverageScore(double score1, double score2, double score3, double score4) {
return (score1+score2+score3+score4)/4;
}
}
0
Hey there hossin Chorfi,
Please add your attempt so that the community can help you more easily. Thanks :)
https://www.sololearn.com/blog/38/8-simple-rules-to-get-help-from-the-community
https://www.sololearn.com/Discuss/333866/?ref=app
0
How much fantasy to ask for a method that accepts an array of doubles as input and returns the average.
which country got talent does the show belong to?
🤣
https://code.sololearn.com/cKW3DPF4970K/?ref=app
0
//create your method here
public static double getAverageScore(double a, double b, double c, double d) {
double average;
return average = (a+b+c+d)/4;
}
}
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 media = calMedia(score1, score2, score3, score4);
System.out.println(media);
}
public static double calMedia(double score1, double score2, double score3, double score4) {
double media = 0;
media = (score1 + score2 + score3 + score4) / 4;
return media;
}
}
0
return average = (a+b+c+d)/4;
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);
}
public static double getAverageScore(double score1, double score2, double score3, double score4) {
return (score1+score2+score3+score4)/4;
}
}