public class StudentScore {
private static int number=1001;
private int studentID;
private int studentNumber;
private String name;
private double regularGrade;
private double finaExam;
private double experimentalGrade;
private double totalScore;
public StudentScore(){ }
public StudentScore(int studentNumber,String name,double regularGrade,double finaExam,double experimentalGrade){
studentID=number;
this.studentNumber=studentNumber;
this.name=name;
this.regularGrade=regularGrade;
this.finaExam=finaExam;
this.experimentalGrade=experimentalGrade;
this.totalScore=setTotalScore();
number++;
}
public double getTotalScore(){
return this.totalScore;
}
private double setTotalScore(){
return regularGrade*0.3+finaExam*0.5+experimentalGrade*0.2;
}
public void printStudent(){
System.out.println(""+this.studentID);
System.out.println("\t"+this.studentNumber);
System.out.println("\t"+this.name);
System.out.println("\t"+this.regularGrade);
System.out.println("\t"+this.finaExam);
System.out.println("\t"+this.experimentalGrade);
System.out.println("\t"+this.totalScore);
}
}
class StudentList{
private static int presentNumber=0;
private String teacher;
private String course;
private StudentScore stdScore[];
public StudentList(){ }
public StudentList(String teacher,String coursr){
this.teacher=teacher;
this.course=course;
this.stdScore=new StudentScore[100];
}
public void addStudent(StudentScore std){
stdScore[presentNumber]=std;
presentNumber++;
}
public void printStudentList(){
System.out.println("课程名称"+course);
System.out.println("任课老师"+teacher);
System.out.println("序号"+"\t学号"+"\t\t姓名"+"平时成绩"+"期末成绩"+"实验成绩"+"总评成绩");
for(int i=0;i<StudentList.presentNumber;i++){
stdScore[i].printStudent();
}
}
}
class Demo0302{
public static void main(String[] args) {
StudentList stdlist=new StudentList("老师","计算机");
StudentScore xm=new StudentScore(2001,"小明",88,96,85);
StudentScore xh=new StudentScore(2002,"小红",86,93,84);
stdlist.addStudent(xm);
stdlist.addStudent(xh);
stdlist.printStudentList();
}
}
学生成绩管理
最新推荐文章于 2024-04-30 12:12:17 发布