complete all parts
This commit is contained in:
@@ -11,33 +11,31 @@ public class StudentManager {
|
||||
|
||||
public void addStudents(ArrayList<Student> newStudents) {
|
||||
|
||||
// TODO:
|
||||
|
||||
// Merge students
|
||||
|
||||
// Hint:
|
||||
// addAll()
|
||||
|
||||
students.addAll(newStudents);
|
||||
}
|
||||
|
||||
public Student searchStudent(int id) {
|
||||
|
||||
// TODO:
|
||||
|
||||
// Loop through students
|
||||
|
||||
// Compare IDs
|
||||
|
||||
for (Student s : students)
|
||||
{
|
||||
if (id == s.getId())
|
||||
{
|
||||
return s;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean removeStudent(int id) {
|
||||
|
||||
// TODO:
|
||||
|
||||
// Find student
|
||||
|
||||
// Remove student
|
||||
for (Student s : students)
|
||||
{
|
||||
if (id == s.getId())
|
||||
{
|
||||
students.remove(s);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user