diff --git a/src/main/java/org/example/Administration.java b/src/main/java/org/example/Administration.java index c1e28a3..53a69b8 100644 --- a/src/main/java/org/example/Administration.java +++ b/src/main/java/org/example/Administration.java @@ -4,10 +4,16 @@ import java.util.ArrayList; import java.util.List; public class Administration { + /** + * Instance Variables + */ private List professors; private List admins; private List students; + /** + * Constructor + */ public Administration() { this.professors = new ArrayList<>(); @@ -16,29 +22,61 @@ public class Administration { } - + /** + * + * @param professorID the id of the professor you want to be deleted from the system + * @return the value of the return statement expresses whether the professor has been deleted + */ public boolean deleteProfessor(String professorID) { for(Professor professor : professors) { if(professor.getProfessorID().equals(professorID)){ professors.remove(professor); - return true; //Course found and removed + return true; } } return false; } + + /** + * + * @param professor the professor you want to add to the system + */ public void addProfessor(Professor professor) { professors.add(professor); } - public boolean deleteAdmin(String AdminID) + /** + * + * @param professorId the id of the professor you want to look for + * @return the value of the return statement expresses whether the professor has been found and if so returns this professor + */ + public Professor findProfessorById(String professorId) + { + for(Professor professor :professors) + { + if(professor.getProfessorID().equals(professorId)) + { + return professor; + } + } + + return null; + } + + /** + * + * @param adminID the id of the admin you want to be deleted from the system + * @return the value of the return statement expresses whether the admin has been deleted + */ + public boolean deleteAdmin(String adminID) { for(Admin admin : admins ) { - if(admin.getId().equals(AdminID)){ + if(admin.getId().equals(adminID)){ admins.remove(admin); return true; //Course found and removed } @@ -47,6 +85,10 @@ public class Administration { return false; } + /** + * + * @param admin the admin you want to add to the system + */ public void addAdmin(Admin admin) { admins.add(admin); @@ -68,6 +110,7 @@ public void addStudents(Student student){ } + }