通过两个类来现实此功能:
- 创建一个学生类Student,用来存储学生信息和成绩。
- 创建一个调用类Student_Method,用来打印学生信息和成绩。
Student类代码如下:
public class Student {
private String name;
private String Sno;
private int English_Score;
private int Math_Score;
private int Sports_Score;
Student(String name,String Sno,int English_Score,int Math_Score,int Sports_Score){
this.name = name;
this.Sno = Sno;
this.English_Score = English_Score;
this.Math_Score = Math_Score;
this.Sports_Score = Sports_Score;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSno() {
return Sno;
}
public void setSno(String sno) {
Sno = sno;
}
public int getEnglish_Score() {
return English_Score;
}
public void setEnglish_Score(int english_Score) {
English_Scor