Browse Source

refactored: Administration class

remotes/origin/fdai7780
fdai7887 11 months ago
parent
commit
cdf2f0daf4
  1. 54
      src/main/java/org/example/Administration.java

54
src/main/java/org/example/Administration.java

@ -67,31 +67,9 @@ public class Administration {
return null;
}
public Admin findAdminById(String adminId)
{
for(Admin admin :admins)
{
if(admin.getId().equals(adminId))
{
return admin;
}
}
return null;
}
public Student findStudentById(String StudentId)
{
for(Student student :students)
{
if(student.getId().equals(StudentId))
{
return student;
}
}
return null;
}
/**
*
* @param adminID the id of the admin you want to be deleted from the system
@ -119,9 +97,22 @@ public class Administration {
admins.add(admin);
}
public boolean deleteStudents(String StudentID){
public Admin findAdminById(String adminId)
{
for(Admin admin :admins)
{
if(admin.getId().equals(adminId))
{
return admin;
}
}
return null;
}
public boolean deleteStudents(String studentID){
for(Student student : students){
if(student.getId().equals(StudentID)){
if(student.getId().equals(studentID)){
students.remove(student);
return true;
}
@ -129,12 +120,23 @@ public class Administration {
return false;
}
public void addStudents(Student student){
public void addStudents(Student student){
students.add(student);
}
}
public Student findStudentById(String studentId)
{
for(Student student :students)
{
if(student.getId().equals(studentId))
{
return student;
}
}
return null;
}
}

Loading…
Cancel
Save