package student;
public class students {
private int studentId;
private String studentName;
private double averageScore;
private static int nextId = 1;
public students(String name,double score) {
studentId = nextId;
nextId++;
studentName = name;
averageScore = score;
}
public students(String name){
this(name,0);
}
public students(){
this("",0);
}
public String toString(String name) {
return name;
}
public int getStudentId(){
return studentId;
}
public void setStudentId(int studentId){
this.studentId = studentId;
}
public String getStudentName(){
return studentName;
}
public void setStudentName(String studentName){
this.studentName = studentName;
}
public double getAverageScore(){
return averageScore;
}
public void setAverageScore(double averageScore){
this.averageScore = averageScore;
}
public static void main(String[] args) {
}
}
package student;
public class operate {
private students s1 = new students("zhangsan",10.77);
private students s2 = new students("lisi",11.44);
private students s3 = new students("wangwu",12.11);
public static void main(String[] args) {
operate op = new operate();
System.out.println(" Id " +op. s1.getStudentId() + " Name " + op.s1.getStudentName() + " Averagescore "
+ op.s1.getAverageScore());
System.out.println(" Id " + op.s2.getStudentId() + " Name " +op. s2.getStudentName() + " Averagescore "
+ op.s2.getAverageScore());
System.out.println(" Id " + op.s3.getStudentId() + " Name " +op. s3.getStudentName() + " Averagescore "
+ op.s3.getAverageScore());
}
}
package student;
public class collageStudent extends students{
private int courseNum;
private float creditHour;
public static void main(String[] args) {
}
}