From f95f8823b1c6553a575129d881e9d40d694fd591 Mon Sep 17 00:00:00 2001 From: Tobias Herbert Date: Tue, 6 Feb 2024 19:51:24 +0100 Subject: [PATCH 1/6] Added Professor and Admin List to Administration Class --- src/main/java/org/example/Administration.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/example/Administration.java b/src/main/java/org/example/Administration.java index f5940fa..76173a3 100644 --- a/src/main/java/org/example/Administration.java +++ b/src/main/java/org/example/Administration.java @@ -1,2 +1,15 @@ -package org.example;public class Administration { +package org.example; + +import java.util.ArrayList; +import java.util.List; + +public class Administration { + private List professors; + private List admins; + + + + } + + From 89c707d037b7832ae81d492165bfe1e12534ebd0 Mon Sep 17 00:00:00 2001 From: Tobias Herbert Date: Tue, 6 Feb 2024 19:54:24 +0100 Subject: [PATCH 2/6] Added Constructor to Administration Class --- src/main/java/org/example/Administration.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/example/Administration.java b/src/main/java/org/example/Administration.java index 76173a3..225f12a 100644 --- a/src/main/java/org/example/Administration.java +++ b/src/main/java/org/example/Administration.java @@ -7,7 +7,11 @@ public class Administration { private List professors; private List admins; - + public Administration() + { + this.professors = new ArrayList<>(); + this.admins = new ArrayList<>(); + } } From 4fda5fa62ee1d27e0128a489e3074c10ff70fd3c Mon Sep 17 00:00:00 2001 From: Tobias Herbert Date: Tue, 6 Feb 2024 20:00:38 +0100 Subject: [PATCH 3/6] Added deleteProfessor Method to Administration Class --- src/main/java/org/example/Administration.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/org/example/Administration.java b/src/main/java/org/example/Administration.java index 225f12a..c92897d 100644 --- a/src/main/java/org/example/Administration.java +++ b/src/main/java/org/example/Administration.java @@ -14,6 +14,21 @@ public class Administration { } + public boolean deleteProfessor(String professorID) + { + for(Professor professor : professors) + { + if(professor.getProfessorID().equals(professorID)){ + professors.remove(professor); + return true; //Course found and removed + } + } + + return false; + } + + + } From 2696d501af4742dc195d171c10fd31d66b7bc466 Mon Sep 17 00:00:00 2001 From: Tobias Herbert Date: Tue, 6 Feb 2024 20:00:56 +0100 Subject: [PATCH 4/6] Added addProfessor Method to Administration Class --- src/main/java/org/example/Administration.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/example/Administration.java b/src/main/java/org/example/Administration.java index c92897d..a2f4326 100644 --- a/src/main/java/org/example/Administration.java +++ b/src/main/java/org/example/Administration.java @@ -26,6 +26,11 @@ public class Administration { return false; } + public void addProfessor(Professor professor) + { + professors.add(professor); + } + From c97d4d79893078413c7b18ef44ea2bc51d62f6b8 Mon Sep 17 00:00:00 2001 From: Tobias Herbert Date: Tue, 6 Feb 2024 20:03:24 +0100 Subject: [PATCH 5/6] Added deleteAdmin Method to Administration Class --- src/main/java/org/example/Administration.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/org/example/Administration.java b/src/main/java/org/example/Administration.java index a2f4326..36c81c2 100644 --- a/src/main/java/org/example/Administration.java +++ b/src/main/java/org/example/Administration.java @@ -31,6 +31,22 @@ public class Administration { professors.add(professor); } + public boolean deleteAdmin(String AdminID) + { + for(Admin admin : admins ) + { + if(admin.getId().equals(AdminID)){ + professors.remove(admin); + return true; //Course found and removed + } + } + + return false; + } + + + + From 679616e2b5f07ec4b30e407cf519d77d0fb9e5b2 Mon Sep 17 00:00:00 2001 From: Tobias Herbert Date: Tue, 6 Feb 2024 20:04:39 +0100 Subject: [PATCH 6/6] Added addAdmin Method to Administration Class --- src/main/java/org/example/Administration.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/example/Administration.java b/src/main/java/org/example/Administration.java index 36c81c2..d7cd3bf 100644 --- a/src/main/java/org/example/Administration.java +++ b/src/main/java/org/example/Administration.java @@ -36,7 +36,7 @@ public class Administration { for(Admin admin : admins ) { if(admin.getId().equals(AdminID)){ - professors.remove(admin); + admins.remove(admin); return true; //Course found and removed } } @@ -44,6 +44,10 @@ public class Administration { return false; } + public void addAdmin(Admin admin) + { + admins.add(admin); + }