From 8cec839c4cfac1b213f1e4acee10b46aff6c873d Mon Sep 17 00:00:00 2001 From: Tobias Herbert Date: Tue, 6 Feb 2024 20:13:56 +0100 Subject: [PATCH] Refactoring: Administration Class --- src/main/java/org/example/Administration.java | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/example/Administration.java b/src/main/java/org/example/Administration.java index 1c00bc8..ba383cb 100644 --- a/src/main/java/org/example/Administration.java +++ b/src/main/java/org/example/Administration.java @@ -20,7 +20,7 @@ public class Administration { { if(professor.getProfessorID().equals(professorID)){ professors.remove(professor); - return true; //Course found and removed + return true; } } @@ -30,12 +30,23 @@ public class Administration { { professors.add(professor); } + public Professor findProfessorById(String professorId) + { + for(Professor professor :professors) + { + if(professor.getProfessorID().equals(professorId)) + { + return professor; + } + } - public boolean deleteAdmin(String AdminID) + return null; + } + 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 } @@ -43,24 +54,12 @@ public class Administration { return false; } - public void addAdmin(Admin admin) { admins.add(admin); } - public Professor findProfessorById(String professorId) - { - for(Professor professor :professors) - { - if(professor.getProfessorID().equals(professorId)) - { - return professor; - } - } - return null; - }