Help in this practice | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

14th Mar 2021, 5:50 PM
hossin Chorfi
hossin Chorfi - avatar
7 Answers
+ 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; } }
4th Sep 2021, 5:29 AM
Fazal Haroon
Fazal Haroon - avatar
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
14th Mar 2021, 6:23 PM
Matthew
Matthew - avatar
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
14th Mar 2021, 8:10 PM
Ciro Pellegrino
Ciro Pellegrino - avatar
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; } }
5th Jul 2021, 9:38 AM
Gowri Kumar
Gowri Kumar - 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 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; } }
24th Dec 2021, 2:09 PM
Changfeng Zheng
0
return average = (a+b+c+d)/4;
26th Feb 2022, 12:47 PM
Abdelrahman Arfat mohamed
Abdelrahman Arfat mohamed - 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); } public static double getAverageScore(double score1, double score2, double score3, double score4) { return (score1+score2+score3+score4)/4; } }
15th Nov 2022, 7:36 AM
Pooja Patel
Pooja Patel - avatar