JudgeScore theirscore = new JudgeScore();
//------------ 1
String [] Contnum1 = new String[5];
String Cont1;
System.out.println(" ");
System.out.println(" ");
System.out.print("\t Enter Name: ");
Cont1 = input.nextLine();
Contnum1[0] = Cont1;
double [] judge1 = new double[5];
System.out.println("Contestant #1 " + Cont1 + " : ");
theirscore.score(judge1);
double largest = theirscore.highest(judge1);
System.out.println("Highest Score is : " + largest );
double lowval = theirscore.lowest(judge1);
System.out.println("The Lowest Score is : " + lowval );
//----------------- 2
String [] Contnum2 = new String[5];
String Cont2;
System.out.println(" ");
System.out.println(" ");
System.out.print("\t Enter Name: ");
Cont2 = input.nextLine();
Contnum2[0] = Cont2;
double [] judge2 = new double[5];
System.out.println("Contestant #2 " + Cont2 + " : ");
theirscore.score(judge2);
largest = theirscore.highest(judge2);
System.out.println("Highest Score is : " + largest );
lowval = theirscore.lowest(judge2);
System.out.println("The Lowest Score is : " + lowval );
class JudgeScore{
double[] score(double[] lima){
Scanner scan = new Scanner(System.in);
//double[] score = new double[5];
System.out.println(" Please Enter The Score: ");
for(int x=1;x<=5;x++)
{
System.out.print("\t Judge #" + x + ": ");
lima[x-1] = scan.nextDouble();
}
System.out.print("\tGiven Score: ");
for(int s=0;s<lima.length;s++)
{
System.out.print(" "+lima[s]);
}
System.out.println("");
return lima;
}
double highest(double[] high){
double largest = high [0];
System.out.println("");
for(int e=1;e<high.length;e++)
{
if(high[e]>largest)
largest=high[e];
}
return largest;
}
double lowest(double[] low){
double lowval = low[0];
for(int e=1;e<low.length;e++)
{
if(low[e]<lowval)
lowval=low[e];
}
return lowval;
}
how will I compute the average per contestant then will rank them to determine the winner?

New Topic/Question
Reply



MultiQuote




|