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;
}
}