编写一个程序实现学员成绩管理
成员变量(属性):
- 每个学员包括3门课的成绩,
- 包括学号、姓名
方法:
- 根据对学员的平均成绩进行分析:
- 利用对象来保存每个学员的信息(根据已学习到的面向对象知识来写)
- 单个学员信息的录入;
- 显示所有学员信息;
- 删除学生;
- 统计某个学生三门课总分 统计某个学生三门课平均分
分析题目
我们要做的:
- 首先要对学生的成员变量放在单独一个类中单独保存
- 将要使用的增删改查的方法写在另一个的类中.
- 将要传入的数据和运行入口写在一个方法中.
第一步:
public class Student_3 {
int number;
String name;
int math;
int chinese;
int english;
int sum = math + chinese + english;
int average = (math + chinese + english) / 3;
public Student_3(int number, String name, int math, int chinese, int english) {
this.number = number;
this.name = name;
this.math = math;
this.chinese = chinese;
this.english = english;
this.average = (math + chinese + english) / 3;
this.sum = math + chinese + english;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getMath() {
return math;
}
public void setMath(int math) {
this.math = math;
}
public int getChinese() {