Ubgrade 7.12

master
david 2022-12-07 11:05:51 +01:00
parent e5287592f0
commit 8b7da94fc7
4 changed files with 26 additions and 6 deletions

View File

@ -19,7 +19,7 @@ public class Datenbank
String result = "";
for(int i = 0; i<Anzahl; i++){
result = result + Studenten[i].toString();
result = result + "\n";
}
return result;
}

19
DualesStudium.java Normal file
View File

@ -0,0 +1,19 @@
/**
* Beschreiben Sie hier die Klasse Hiwi.
*
* @author (Ihr Name)
* @version (eine Versionsnummer oder ein Datum)
*/
public class DualesStudium extends Student
{
String Jobbezeichnung;
public DualesStudium (String Name, int m, String s, String j ){
super(Name, m, s);
Jobbezeichnung = j;
}
public String toString(){
return super.toString() + "und arbeitet als" + Jobbezeichnung;
}
}

View File

@ -8,12 +8,12 @@
public class Student
{
//Attribute
private String Name;
private int Matrikelnummer;
private String Studiengang;
protected String Name;
protected int Matrikelnummer;
protected String Studiengang;
//Konstruktor
public Student (String n, int m, String g){
Name = n;
public Student (String Name, int m, String g){
this.Name = Name;
Matrikelnummer = m;
Studiengang = g;

View File

@ -14,6 +14,7 @@ public class StudentTest
db.addStudent(new Student("Klaus",24658,"Kunst "));
db.addStudent(new Student("Emma",24659,"Bio "));
db.addStudent(new DualesStudium("Kiwi ", 12476, "Obstwissenschaften ", " Protokologe."));
System.out.println(db);
}