计算学生成绩
package Student;
import java.util.Scanner;
public class Student {
/**
* 计算学生成绩
*/
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
double[] student=new double[3];
double sum=0;
double num=0;
for(int i=0;i<student.length;i++){
System.out.println("请输入第"+(i+1)+"个学生的成绩");
double grade=s.nextDouble();
student[i]=grade;
}
for(int j=0;j<student.length;j++){
sum+=student[j];
}System.out.println("总成绩为"+sum);
System.out.println("平均成绩为"+sum/3);
for(int k=0;k<student.length;k++){
if(num < student[k]){
num = student[k];
}
}
System.out.println("最高成绩为"+num);
}
}