+ Completed every TODOs

+ Implemented the solution for the question asked in lecture
+ Changed students.txt format to csv
This commit is contained in:
2026-05-24 21:04:24 +03:30
parent 83746b88f6
commit 2315188299
7 changed files with 89 additions and 90 deletions
+11 -18
View File
@@ -10,34 +10,27 @@ public class StudentManager {
private final ArrayList<Student> students = new ArrayList<>();
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 student : students){
if (student.getId() == id){
return student;
}
}
return null;
}
public boolean removeStudent(int id) {
// TODO:
Student student = searchStudent(id);
// Find student
// Remove student
if (student != null){
students.remove(student);
return true;
}
return false;
}