键盘录入5个学生成绩信息(姓名,语文成绩,数学成绩,英语成绩),按照总分降序输出
package temp;
public class StudentGrade {
private String name; //姓名
private int chinese; //语文成绩
private int maths; //数学成绩
private int english; //英语成绩
private int sum; //总成绩
public StudentGrade() { //alt + shift + s c
super();
}
public StudentGrade(String name, int chinese, int maths, int english) { //alt + shift + s o
super();
this.name = name;
this.chinese = chinese;
this.maths = maths;
this.english = english;
this.sum = this.chinese + this.maths + this.english;
}
public int getSum() { //alt + shift + s r
return sum;
}
@Override
public String toString() { //alt + shift + s s
return "(" + name + ", " + chinese + ", " + maths + ", " + english + ")" + "总" + sum + "分";
}
}
</