From 62864ead8293c4c7962bb3a42818e964d48c3386 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Thu, 25 Nov 2021 14:47:38 +0100 Subject: [PATCH] =?UTF-8?q?Aufgabe=202=20ausgef=C3=BChrt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Dozent.java | 20 ++++++++++++++++++++ src/Person.java | 15 +++++++++++++++ src/Student.java | 17 +++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 src/Dozent.java create mode 100644 src/Person.java create mode 100644 src/Student.java diff --git a/src/Dozent.java b/src/Dozent.java new file mode 100644 index 0000000..6140c6f --- /dev/null +++ b/src/Dozent.java @@ -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; + } +} diff --git a/src/Person.java b/src/Person.java new file mode 100644 index 0000000..e73dc06 --- /dev/null +++ b/src/Person.java @@ -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; + } + +} diff --git a/src/Student.java b/src/Student.java new file mode 100644 index 0000000..d0b3c77 --- /dev/null +++ b/src/Student.java @@ -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; + } +}