学生成绩管理



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();
    }
}

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值