Java程序编写学生成绩管理系统

Java程序编写学生成绩管理系统实现学生学号,数学,语文,英语成绩录入并且计算平均成绩,按照平均成绩高低输出信息你可以改改!//实现简单的学生信息输入输出和初步的成绩排序public class Student {private int id; //学号private int mathScore; //数学成绩private int chinScore; //语文成绩private int foreScore; //外语成绩public Student() {id = 0;mathScore = 0;chinScore = 0;foreScore = 0;}public Student(int newId, int newMathScore, int newChinSvore,int newForeScore) {id = newId;mathScore = newMathScore;chinScore = newChinSvore;foreScore = newForeScore;}public double getAverageScore() { //求平均成绩double averageScore = ((double) mathScore + chinScore + foreScore) / 3;return averageScore;}public void output(Student student) { //输出对象的内容System.out.println(" " + student.id + " " + student.mathScore +" " + student.chinScore + " "+ student.foreScore + " " +student.getAverageScore());}public int max(Student a[], int n) { //Student类对象数组的前n项中的成绩最大值的索引int position = 0;for (int i = 1; i < n; i++) {if (a[i].getAverageScore() > a[position].getAverageScore()) { //比较平均成绩position = i;}}return position;}public void selectSort(Student a[]) { //Student类对象数组的选择排序for (int n = a.length; n > 1; n--) {int i = max(a, n);Student temp = a[i];a[i] = a[n - 1];a[n - 1] = temp;}}}

赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《Java程序编写学生成绩管理系统》
文章链接:https://www.skykkk.com/archives914.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

相关推荐

  • 暂无文章