Browse Source

Refactoring: Administration Class

remotes/origin/fdai7780
Tobias Herbert 11 months ago
parent
commit
8cec839c4c
  1. 29
      src/main/java/org/example/Administration.java

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

@ -20,7 +20,7 @@ public class Administration {
{ {
if(professor.getProfessorID().equals(professorID)){ if(professor.getProfessorID().equals(professorID)){
professors.remove(professor); professors.remove(professor);
return true; //Course found and removed
return true;
} }
} }
@ -30,12 +30,23 @@ public class Administration {
{ {
professors.add(professor); 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 ) for(Admin admin : admins )
{ {
if(admin.getId().equals(AdminID)){
if(admin.getId().equals(adminID)){
admins.remove(admin); admins.remove(admin);
return true; //Course found and removed return true; //Course found and removed
} }
@ -43,24 +54,12 @@ public class Administration {
return false; return false;
} }
public void addAdmin(Admin admin) public void addAdmin(Admin admin)
{ {
admins.add(admin); admins.add(admin);
} }
public Professor findProfessorById(String professorId)
{
for(Professor professor :professors)
{
if(professor.getProfessorID().equals(professorId))
{
return professor;
}
}
return null;
}

Loading…
Cancel
Save