34 lines
859 B
Java
34 lines
859 B
Java
|
package test;
|
||
|
|
||
|
class Postgraduate extends Student {
|
||
|
public Postgraduate(String name)
|
||
|
{
|
||
|
super(name,"研究生");
|
||
|
}
|
||
|
public void calculateGrade()
|
||
|
{
|
||
|
int total = 0;
|
||
|
double average = 0;
|
||
|
for (int i = 0; i < CourseNo; i++) {
|
||
|
total =total + getCourseScore(i);
|
||
|
};
|
||
|
average = total / CourseNo;
|
||
|
String currentGrade="";
|
||
|
if (average>=90){
|
||
|
currentGrade = "优秀";
|
||
|
}
|
||
|
else if (average>=80&&average<90) {
|
||
|
currentGrade = "良好";
|
||
|
}
|
||
|
else if (average>=70&&average<80) {
|
||
|
currentGrade = "一般";
|
||
|
}
|
||
|
else if (average>=60&&average<70) {
|
||
|
currentGrade = "及格";
|
||
|
}
|
||
|
else{
|
||
|
currentGrade = "不及格";
|
||
|
}
|
||
|
setCourseGrade(currentGrade);
|
||
|
}
|
||
|
}
|