School.java
Dosyayı İndir
package com.godoro.education;
import java.util.ArrayList;
import java.util.List;
public class School {
private long schoolId;
private String schoolName;
private List<Student> studentList=new ArrayList<Student>();
public School(long schoolId, String schoolName) {
this.schoolId = schoolId;
this.schoolName = schoolName;
}
public School() {
}
public long getSchoolId() {
return schoolId;
}
public void setSchoolId(long schoolId) {
this.schoolId = schoolId;
}
public String getSchoolName() {
return schoolName;
}
public void setSchoolName(String schoolName) {
this.schoolName = schoolName;
}
public List<Student> getStudentList() {
return studentList;
}
public void setStudentList(List<Student> studentList) {
this.studentList = studentList;
}
public Student find(long studentId){
for(Student student : studentList){
if(student.getStudentId()==studentId){
return student;
}
}
return null;
}
public Student addStudent(long studentId,String studentName,double averageMark){
Student student=new Student(studentId, studentName, averageMark);
student.setSchool(this);
studentList.add(student);
return student;
}
}
Dosyayı İndir