Browse Source

Merge branch 'master' of https://gitlab.cs.hs-fulda.de/fdai7600/PWN_Alpha_Dogs into fdai7887

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

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

@ -4,10 +4,16 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
public class Administration { public class Administration {
/**
* Instance Variables
*/
private List<Professor> professors; private List<Professor> professors;
private List<Admin> admins; private List<Admin> admins;
private List<Student> students; private List<Student> students;
/**
* Constructor
*/
public Administration() public Administration()
{ {
this.professors = new ArrayList<>(); 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) public boolean deleteProfessor(String professorID)
{ {
for(Professor professor : professors) for(Professor professor : professors)
{ {
if(professor.getProfessorID().equals(professorID)){ if(professor.getProfessorID().equals(professorID)){
professors.remove(professor); professors.remove(professor);
return true; //Course found and removed
return true;
} }
} }
return false; return false;
} }
/**
*
* @param professor the professor you want to add to the system
*/
public void addProfessor(Professor professor) public void addProfessor(Professor professor)
{ {
professors.add(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 ) 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
} }
@ -47,6 +85,10 @@ public class Administration {
return false; return false;
} }
/**
*
* @param admin the admin you want to add to the system
*/
public void addAdmin(Admin admin) public void addAdmin(Admin admin)
{ {
admins.add(admin); admins.add(admin);
@ -68,6 +110,7 @@ public void addStudents(Student student){
} }
} }
Loading…
Cancel
Save