java习题 求学生平均成绩
1.编写学生类(Student),包括学号、语文成绩、数学成绩、英语成绩。计算平均成绩的方法。
2.创建6个学生对象,学生成绩采用随机数生成。将学生对象存入集合中。
3.按照学生平均分数从高到低的顺序,打印输出所有学生的信息,信息格式:(学号,语文成绩,数学成绩,英语成绩,平均成绩)
public class Student {
private int studentNum;
private int chineseScore;
private int englishScore;
private int mathScore;
private int average;
public Student(int studentNum, int chineseScore, int englishScore, int mathScore) {
this.studentNum = studentNum;
this.chineseScore = chineseScore;
this.englishScore = englishScore;
this.mathScore = mathScore;
this.average = (studentNum+chineseScore+englishScore+mathScore)/4;

这篇博客主要探讨如何使用Java编程解决计算一组学生平均成绩的问题。通过实例代码,详细解释了如何读取学生分数并计算平均值,对初学者具有一定的指导意义。
最低0.47元/天 解锁文章
2564

被折叠的 条评论
为什么被折叠?



