diff --git a/src/campus/App.java b/src/campus/App.java deleted file mode 100644 index 8df458e474fd822739536b55179b03f2e3699bbe..0000000000000000000000000000000000000000 --- a/src/campus/App.java +++ /dev/null @@ -1,42 +0,0 @@ -package io.fp.campus; - -public class App { - - public static void main(String[] args) { - - Faculty hogwarts = new Faculty("Hogwarts"); - - Professor dumbledore = new Professor("Dumbledore", 77, "BPM", hogwarts); - System.out.println(dumbledore.getName()); - System.out.println("Hält er Vorlesung? "+dumbledore.isTalking()); - dumbledore.setTalking(false); - System.out.println("Hält er Vorlesung? "+dumbledore.isTalking()); - - Assistent hagrid = new Assistent("Hagrid", 26, hogwarts); - hagrid.setBoss(dumbledore); - System.out.println(hagrid.getName()); - System.out.println(hagrid.getBoss().getName()); - - Assistent dobby = new Assistent("Dobby", 130, hogwarts); - dobby.setBoss(dumbledore); - - Assistent pince = new Assistent("Madam Pince", 50, hogwarts); - - hogwarts.addProfessor(dumbledore); - hogwarts.addAssistent(hagrid); - hogwarts.addAssistent(dobby); - hogwarts.addAssistent(pince); - - System.out.println("Fakultät "+ hogwarts.getName()); - System.out.println(hogwarts.getProfs().toString()); - System.out.println(hogwarts.getAssis().toString()); - - System.out.println(hogwarts.getAssisOfProf(dumbledore)); - - System.out.println(hogwarts.getProfsWithAssis()); - - System.out.println("Anzahl Profs: " + hogwarts.getAmountProfs()); - - System.out.println("Anzahl Assis: " + hogwarts.getAmountAssis()); - } -} diff --git a/src/campus/Assistent.java b/src/campus/Assistent.java deleted file mode 100644 index 4782e57885e2bc6f3a49288543920a1b23a5a630..0000000000000000000000000000000000000000 --- a/src/campus/Assistent.java +++ /dev/null @@ -1,46 +0,0 @@ -package io.fp.campus; - -/** - * Assistent - */ -public class Assistent { - - private String name; - private int age; - private Professor boss; - private Faculty faculty; - - public Assistent(String name, int age, Faculty faculty) { - this.name=name; - this.age=age; - this.faculty = faculty; - } - - public void setBoss(Professor boss) { - this.boss=boss; - } - - public Professor getBoss() { - return boss; - } - - public String getName() { - return name; - } - - public int getAge() { - return age; - } - - public String toString() { - return name; - } - - public void setFaculty(Faculty faculty) { - this.faculty = faculty; - } - - public Faculty getFaculty() { - return this.faculty; - } -} \ No newline at end of file diff --git a/src/campus/Faculty.java b/src/campus/Faculty.java deleted file mode 100644 index a7436b088c7b8bb8b640296d74d2774334cab8a6..0000000000000000000000000000000000000000 --- a/src/campus/Faculty.java +++ /dev/null @@ -1,89 +0,0 @@ -package io.fp.campus; - -import java.util.ArrayList; -/** - * Faculty - */ -public class Faculty { - - private String name; - private ArrayList<Professor> profs; - private ArrayList<Assistent> assis; - - public Faculty(String name) { - this.name=name; - this.assis=new ArrayList<Assistent>(); - this.profs=new ArrayList<Professor>(); - } - - public String getName() { - return name; - } - - public void addProfessor(Professor professor) { - if (!profs.contains(professor)) { - profs.add(professor); - } - else { - throw new RuntimeException(); - } - } - - public void addAssistent(Assistent assistent) { - if (!assis.contains(assistent)) - assis.add(assistent); - } - - public ArrayList<Professor> getProfs() { - return profs; - } - - public ArrayList<Assistent> getAssis() { - return assis; - } - - public ArrayList<Assistent> getAssisOfProf(Professor professor) { - - ArrayList<Assistent> profassis = new ArrayList<>(); - - if (!profs.contains(professor)){ - - return profassis; - } - - for (Assistent assi : assis) { - Professor p = assi.getBoss(); - if (p!=null&&p.equals(professor)) { - profassis.add(assi); - } - } - return profassis; - } - - public ArrayList<Professor> getProfsWithAssis(){ - - ArrayList<Professor> profsWithAssis = new ArrayList<>(); - - for(Assistent assi : assis){ - - Professor p = assi.getBoss(); - - if(p != null && !profsWithAssis.contains(p)){ - - profsWithAssis.add(p); - } - } - - return profsWithAssis; - } - - public int getAmountProfs(){ - - return profs.size(); - } - - public int getAmountAssis(){ - - return assis.size(); - } -} \ No newline at end of file diff --git a/src/campus/Professor.java b/src/campus/Professor.java deleted file mode 100644 index c16b5a0f29d6f3ff0d6936663ace98950a674652..0000000000000000000000000000000000000000 --- a/src/campus/Professor.java +++ /dev/null @@ -1,61 +0,0 @@ -package io.fp.campus; - -public class Professor { - - private String name; - private int age; - private boolean isTalking= true; - private String researchArea=null; - private Faculty faculty; - - public Professor(String name, int age, String researchArea, Faculty faculty) { - this.name=name; - this.age=age; - this.researchArea=researchArea; - this.faculty=faculty; - } - - public void setTalking(boolean isTalking) { - this.isTalking=isTalking; - } - - public boolean isTalking() { - return isTalking; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name=name; - } - - public String getResearchArea() { - return researchArea; - } - - public void setResearchArea(String researchArea) { - this.researchArea=researchArea; - } - - public void setFaculty(Faculty faculty) { - this.faculty = faculty; - } - - public Faculty getFaculty() { - return this.faculty; - } - - public String toString() { - return name; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } -} \ No newline at end of file