I need help writing this program. \"In a gymnastics or divingcompetition, each c
ID: 3607946 • Letter: I
Question
I need help writing this program. "In a gymnastics or divingcompetition, each contestant's score is calculated by dropping thelowest and highest scores and then adding the remaining scores.Write a program that allows the user to enter eight judges' scoresand then outputs the points received by the contestant. Format theoutput with two decimal places. A judge awards points between 1 and10, with 1 being the lowest and 10 being the highest. For example,if the scores are 9.2, 9.3, 9.0, 9.9, 9.5, 9.6, and 9.8, thecontestant receives a total of 56.90 points.
Any help would be appreciated.
Explanation / Answer
the data you provided has only 7 entries when in the beginning thequestion states to allow 8 entries so....yeah heres the code the will work for 8 entries. import java.io.*; import java.math.BigDecimal; public class Diving { public static void main(String[] args) { try { BufferedReader in = new BufferedReader(newInputStreamReader(System.in)); doublescore[] = new double[8]; double low= 10.0, high = 0.0, sum = 0.0; for(int i= 0; i < 8; i++) { System.out.println("Score " + (i+1) + ":"); score[i] =Double.parseDouble(in.readLine()); if(score[i] > high) high = score[i]; if(score[i]Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.