Aufgabe 2 ausgeführt.

This commit is contained in:
schrom01 2021-11-25 14:47:38 +01:00
parent a7f7356d96
commit 62864ead82
3 changed files with 52 additions and 0 deletions

20
src/Dozent.java Normal file
View File

@ -0,0 +1,20 @@
public class Dozent extends Person{
private String bueronummer;
private String telefonnummer;
public Dozent(String name, String id, String bueronummer, String telefonnummer) {
super(name, id);
this.bueronummer = bueronummer;
this.telefonnummer = telefonnummer;
}
public String gibBuero(){
return bueronummer;
}
public String gibTelefonnummer() {
return telefonnummer;
}
}

15
src/Person.java Normal file
View File

@ -0,0 +1,15 @@
public class Person {
private String name;
private String id;
public Person(String name, String id){
this.name = name;
this.id = id;
}
public String gibInfo(){
return name + ", ID: " + id;
}
}

17
src/Student.java Normal file
View File

@ -0,0 +1,17 @@
public class Student extends Person{
private int anzahlCredits;
public Student(String name, String id) {
super(name, id);
anzahlCredits = 0;
}
public int gibCredits() {
return anzahlCredits;
}
public void erhoeheCredits(int anzahl) {
anzahlCredits += anzahl;
}
}