写一个Java程序,实现以下要求:学生参加某课程的考试,课程类型分为考试课和考查课.考试课最终成绩计算方法:出勤*10%+作业*10%+实验*10%+期末*70%考查课最终成绩计算方法:出勤*20%+作业*10%+
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/29 05:01:30
写一个Java程序,实现以下要求:学生参加某课程的考试,课程类型分为考试课和考查课.考试课最终成绩计算方法:出勤*10%+作业*10%+实验*10%+期末*70%考查课最终成绩计算方法:出勤*20%+作业*10%+
写一个Java程序,实现以下要求:
学生参加某课程的考试,课程类型分为考试课和考查课.
考试课最终成绩计算方法:出勤*10%+作业*10%+实验*10%+期末*70%
考查课最终成绩计算方法:出勤*20%+作业*10%+实验*10%+期末*60%
写一个Java程序,实现以下要求:学生参加某课程的考试,课程类型分为考试课和考查课.考试课最终成绩计算方法:出勤*10%+作业*10%+实验*10%+期末*70%考查课最终成绩计算方法:出勤*20%+作业*10%+
/*感觉你应该只是个学生,要应付老师的作业,如果是这样呢,下面的代码对你来说太繁琐了,但是如果真的想学好java,能理解这段代码对你会有帮助的*/
class Test
{
public static void main(String[] args){
KaoShi ks1 = new KaoShiKe(90,80,70,60);
KaoShi ks2 = new KaoChaKe(60,70,80,90);
System.out.println(ks1.chengJi);
System.out.println(ks2.chengJi);
}
}
abstract class KaoShi
{
double chengJi;
double chuQing;
double zuoYe;
double shiYan;
double qiMo;
}
class KaoShiKe extends KaoShi
{
//出勤*10%+作业*10%+实验*10%+期末*70%
KaoShiKe(double chuQing,double zuoYe,double shiYan,double qiMo){
this.chuQing = chuQing;
this.zuoYe = zuoYe;
this.shiYan = shiYan;
this.qiMo = qiMo;
this.chengJi = chuQing/10+zuoYe/10+shiYan/10+qiMo*7/10;
}
}
class KaoChaKe extends KaoShi
{
//出勤*20%+作业*10%+实验*10%+期末*60%
KaoChaKe(double chuQing,double zuoYe,double shiYan,double qiMo){
this.chuQing = chuQing;
this.zuoYe = zuoYe;
this.shiYan = shiYan;
this.qiMo = qiMo;
this.chengJi = chuQing*2/10+zuoYe/10+shiYan/10+qiMo*6/10;
}
}