Compare commits

...

2 Commits

Author SHA1 Message Date
Stadelmeier
90954ad137 Merge branch 'main' of ssh://gitea.hb.dhbw-stuttgart.de:2222/sebastianbrosch/VL-Programmieren 2024-01-23 17:16:08 +01:00
Stadelmeier
c17fd51e08 Add constructors 2024-01-23 17:05:47 +01:00
5 changed files with 20 additions and 4 deletions

View File

@ -2,7 +2,12 @@ class Angestellter extends Mitarbeiter {
double monatsGehalt;
void print(){
public Angestellter(int personalNummer, String name, String vorname, double monatsGehalt) {
super(personalNummer, name, vorname);
this.monatsGehalt = monatsGehalt;
}
void print(){
System.out.println(getPersonalNummer());
System.out.println(getName());
System.out.println(getVorname());

View File

@ -1,6 +1,6 @@
class Aufgabe {
public static void main(String[] args) {
Manager person = new Manager();
Manager person = new Manager(1, "Wurst", "Hans", 100, 1000);
person.print();
}
}

View File

@ -1,8 +1,9 @@
public class LeitenderAngestellter extends Angestellter {
double bonus;
LeitenderAngestellter(double bonus) {
super();
public LeitenderAngestellter(int personalNummer, String name, String vorname, double monatsGehalt, double bonus) {
super(personalNummer, name, vorname, monatsGehalt);
this.bonus = bonus;
}
void print() {

View File

@ -1,6 +1,10 @@
class Manager extends LeitenderAngestellter {
Dienstwagen dienstwagen;
public Manager(int personalNummer, String name, String vorname, double gehalt, double bonus){
super(personalNummer, name, vorname, gehalt, bonus);
}
void print() {
super.print();

View File

@ -3,6 +3,12 @@ abstract class Mitarbeiter{
String name;
String vorname;
public Mitarbeiter(int personalNummer, String name, String vorname) {
this.personalNummer = personalNummer;
this.name = name;
this.vorname = vorname;
}
abstract void print();
void setPersonalNummer(int i){personalNummer=i;}
void setName(String s){name=s;}