学生成绩统计
以下为程序:
import java.ul.Scanner;
public class MainStudent {
public stac void main(String args[]) {
StudentScore ss=new StudentScore();
}
}
class StudentScore {
int i,j,n,rank;
double Chinese,math,English;
String name;
Student student[];
Scanner reader=new Scanner(System.in);
public StudentScore() {
init();
sort();
setRank();
show();
}
void init() {
System.out.print("请输入学生人数:");
n=reader.nextInt();
student=new Student[n];
for(i=0;i<student.length;i++) {
reader.nextLine();
System.out.print("Student"+(i+1)+".name :");
name=reader.nextLine();
System.out.print("Student"+(i+1)+".Chinese:");
Chinese=reader.nextDouble();
System.out.print("Student"+(i+1)+".Math :");
math=reader.nextDouble();
System.out.print("Student"+(i+1)+".English:");
English=reader.nextDouble();
student[i]=new Student(name,Chinese,math,English);
student[i].setAverage(student[i].getTotal());
System.out.println();
}
评论0
最新资源