用java写一个学生出勤的程序,求高手解答!!!
有四个同学;满分30分1:迟到一次扣一分;(显示迟到次数)2:旷课一次扣3分;(显示旷课次数)3:回答问题加一分;(显示回答问题次数)4:旷课8次总分为0.执行程序显示出...
有四个同学;
满分30分
1:迟到一次扣一分;(显示迟到次数)
2:旷课一次扣3分;(显示旷课次数)
3:回答问题加一分;(显示回答问题次数)
4:旷课8次总分为0.
执行程序显示出 学生学号,学生姓名,迟到次数,旷课次数,回答问题次数,最后总计分数 展开
满分30分
1:迟到一次扣一分;(显示迟到次数)
2:旷课一次扣3分;(显示旷课次数)
3:回答问题加一分;(显示回答问题次数)
4:旷课8次总分为0.
执行程序显示出 学生学号,学生姓名,迟到次数,旷课次数,回答问题次数,最后总计分数 展开
2个回答
展开全部
看下这个类似代码,模仿来做
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;
}
}
希望对你有帮助
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;
}
}
希望对你有帮助
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询