package test; public abstract class Student { final static int CourseNo = 3; private String name; private String type; private int[] courses; private String courseGrade; public Student(){ } public Student(String name,String type) { this.name = name; this.type = type; courses = new int[3]; courseGrade=""; } public abstract void calculateGrade(); public String getName( ) { return name; } public String getType( ) { return type; //返回学生类型 } public String getCourseGrade( ) { return courseGrade; } public int getCourseScore(int courseNumber) { return courses[courseNumber]; } public void setName(String name) { this.name = name; } public void setType(String type) { this.type = type; } public void setCourseScore(int courseNumber, int courseScore) { courses[courseNumber] = courseScore;//按课程索引号设置课程成绩 } public void setCourseGrade(String courseGrade) { this.courseGrade = courseGrade; } }