怎么在Graduate类中写一个方法用来判断学生是否达到录取分数线,所有类都已经写好了,只是不知道怎么样写主类里面的判断方法,JAVA起步,大家帮帮忙吧
class School{ //定义学校类,包含setScoreLine和getScoreLine方法
int scoreLine;
void setScoreLine(){
this.scoreLine = scoreLine;
}
void getScoreLine(){
System.out.println("The scoreLine is :" + scoreLine);
}
}
class Student{ //定义学生类
String name;
long id;
int intgretResult;
int sports;
public Student(String name,long id,int intgretResult,int sports){
System.out.println("姓名是"+name+" "+"考号是"+id+" "+"综合成绩是"+intgretResult+"体育成绩是"+sports);
}
void getIntgretResult(int intgretResult,int sports){
System.out.println("The intgretResult is"+intgretResult+" "+"sports is"+sports);
}
}
public class Graduate{ //定义Graduate类,用来实现输出学生信息,并且要判断学生是否被符合录取要求
public static void main(String args[]){
School sc = new School();
sc.scoreLine = 400;
sc.setScoreLine();
sc.getScoreLine();
Student S1 = new Student("幽助",1621011,200,80);
Student S2 = new Student("藏马",1621012,290,150);
Student S3 = new Student("飞影",1621013,659,150);
Student S4 = new Student("桑原",1621014,270,150);
怎样在这个类里面写判断方法呢?(判断条件,intgretResult(总体成绩)>scoreLine (分数线) 或者 sports(体育成绩)>96并且intgretResult>300)
我不太明白要怎么实现这个判断,如果有四个学生的话,怎么写呢?
}
}