/** three classes of students to participate in competitions, five students per class,
1. Find out the total and average scores of each class
2. Find out the highest score for each class
3. Find the highest score in all fractions */
Package eduask01;
Import java.util.*;
public class rask5{
public static void Main (String[]args) {
Scanner sc=new Scanner (system.in);
Double SUM1=0,SUM2=0,SUM3=0;//3 each class to set a total score
Double MAX=0,MAX1=0,MAX2=0,MAX3=0;//3 each class to set a maximum score
for (int i=1;i<=3;i++) {Double sum=0;//this is important to store the second zero for each class total
for (int j=1;j<=5;j++) {System.out.println ("Please enter section" +i+ "Class" +j+ "The score of the classmates");//traversal input each class each student results
Double score=sc.nextdouble ();
if (j==1) {
max=score;sum+=score;//maximum value to store the total score of each class
}else if (max<score) {max=score;} Classic Judgment Max.
}
if (i==1) {sum1=sum;//receives 1th class highest score and total score
Max1=max;
}else if (i==2) {//Receive 2nd Class highest score and total score
Sum2=sum;max2=max;
}else if (i==3) {//Receive 3rd class highest score and total score
Sum3=sum;max3=max;
}
}if (MAX1>=MAX2&&MAX1>=MAX3) {//Compare the highest grades of each class
System.out.println ("All scores are divided into the highest +max1");
}else if (max2>=max1&&max2>=max3) {
System.out.println ("All scores are divided into the highest +max2");
}
else if (MAX3>=MAX2&&MAX3>=MAX1) {
System.out.println ("All scores are divided into the highest +max3);//FINAL output
}
System.out.println ("The 1th class is divided into:" +sum1+ "average is divided into:" +sum1/5+ "highest into:" +MAX1);
System.out.println ("The 2nd class is divided into:" +sum2+ "average is divided into:" +sum2/5+ "highest into:" +MAX2);
System.out.println ("The 3rd class is divided into:" +sum3+ "average is divided into:" +sum3/5+ "highest into:" +MAX3);
}
}
Java basis for 3 classes 5 students score