Help please! I've been trying to make this work for a while. The problem is such:
Write a program that allows the user to enter eight judges' scores and then outputs the points received by the contestant. Format your output with two decimal places. A judge awards points between 1 and 10, 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.5, 9.6, and 9.8, the contestant receives a total of 56.90.
I believe that I have nearly completed everything correctly. What I can't figure out is how to calculate the sum of the remaining 6 numbers of the Array which is assigned the variable total in the calculateScore method and retrieve the variable. My last print statement is supposed to read ("The score of "+contestant+" is "+total+":"). Not sure how to correctly call the method calculateScore or where to put the print message without receiving the error:cannot find symbol - variable contestant
import java.util.Scanner; import javax.swing.*; public class Judging { public static void main(String[]args)//void, returns nothing { Scanner console = new Scanner (System.in); String contestant; double []scores = new double[8]; int n = 8; do { System.out.println("What is the name of the contestant? "); contestant= console.nextLine(); getData(scores,n,console); } while(true); } private static void getData(double []scores, int n, Scanner console) { double judge; for(int i=0;i<n;i++) { do { System.out.print("Give the score for the judge number "+(i+1)+": "); judge = console.nextDouble(); if (judge < 1 || judge > 10) System.out.println("Sorry! The score must be between 1 and 10"); else scores[i] = judge; } while (judge < 1 || judge > 10); } console.nextLine(); } private static double calculateScore(double []scores, int n) { double minValue = scores[0]; double maxValue = scores[0]; double total = 0.00; if (scores[n] < minValue) { minValue = scores[n]; } if (scores[n] > maxValue) { maxValue = scores[n]; } for (int i = 0; i < 8; i++) { if (scores[n] != minValue && scores[n] != maxValue) { total = total + scores[n]; //System.out.println("The score of "+contestant+"is "+total+":");????? } } return total; } }