Vorlesung 6 / Aufgabe 1
This commit is contained in:
parent
a91b597a20
commit
d31a881078
15
VL06/Aufgabe01/Angestellter.java
Normal file
15
VL06/Aufgabe01/Angestellter.java
Normal file
@ -0,0 +1,15 @@
|
||||
package VL06.Aufgabe01;
|
||||
|
||||
class Angestellter extends Mitarbeiter {
|
||||
protected double monatsGehalt;
|
||||
|
||||
Angestellter(int personalNummer, String name, String vorname, double monatsGehalt) {
|
||||
super(personalNummer, name, vorname);
|
||||
this.monatsGehalt = monatsGehalt;
|
||||
}
|
||||
|
||||
void print() {
|
||||
System.out.printf("\n%s, %s (%d):\n", this.getName(), this.getVorname(), this.getPersonalNummer());
|
||||
System.out.printf(" Monatsgehalt: %.2f Euro\n", this.monatsGehalt);
|
||||
}
|
||||
}
|
15
VL06/Aufgabe01/Arbeiter.java
Normal file
15
VL06/Aufgabe01/Arbeiter.java
Normal file
@ -0,0 +1,15 @@
|
||||
package VL06.Aufgabe01;
|
||||
|
||||
class Arbeiter extends Mitarbeiter {
|
||||
protected double stundenSatz;
|
||||
|
||||
Arbeiter(int personalNummer, String name, String vorname, double stundenSatz) {
|
||||
super(personalNummer, name, vorname);
|
||||
this.stundenSatz = stundenSatz;
|
||||
}
|
||||
|
||||
void print() {
|
||||
System.out.printf("\n%s, %s (%d):\n", this.getName(), this.getVorname(), this.getPersonalNummer());
|
||||
System.out.printf(" Stundensatz: %.2f Euro\n", this.stundenSatz);
|
||||
}
|
||||
}
|
15
VL06/Aufgabe01/Aufgabe01.java
Normal file
15
VL06/Aufgabe01/Aufgabe01.java
Normal file
@ -0,0 +1,15 @@
|
||||
package VL06.Aufgabe01;
|
||||
|
||||
/**
|
||||
* Vorlesung 6 / Aufgabe 1
|
||||
*/
|
||||
public class Aufgabe01 {
|
||||
public static void main(String[] args) {
|
||||
Arbeiter frankMeier = new Arbeiter(4711, "Meier", "Frank", 14.67);
|
||||
frankMeier.print();
|
||||
Facharbeiter steffiMueller = new Facharbeiter(4712, "Müller", "Steffi", 18.33, "Chemie");
|
||||
steffiMueller.print();
|
||||
Manager karlHeinzKaiser = new Manager(4713, "Kaiser", "Karl-Heinz", 3000.00, 400.00, "Mazda Cabrio", "S-ZZ 999");
|
||||
karlHeinzKaiser.print();
|
||||
}
|
||||
}
|
17
VL06/Aufgabe01/Dienstwagen.java
Normal file
17
VL06/Aufgabe01/Dienstwagen.java
Normal file
@ -0,0 +1,17 @@
|
||||
package VL06.Aufgabe01;
|
||||
|
||||
public class Dienstwagen {
|
||||
private String wagentyp;
|
||||
private String kennzeichen;
|
||||
|
||||
Dienstwagen(String wagentyp, String kennzeichen) {
|
||||
this.wagentyp = wagentyp;
|
||||
this.kennzeichen = kennzeichen;
|
||||
}
|
||||
|
||||
public void print() {
|
||||
System.out.println("Dienstwagen:");
|
||||
System.out.printf(" Wagentyp: %s\n", this.wagentyp);
|
||||
System.out.printf(" Kennzeichen: %s\n", this.kennzeichen);
|
||||
}
|
||||
}
|
16
VL06/Aufgabe01/Facharbeiter.java
Normal file
16
VL06/Aufgabe01/Facharbeiter.java
Normal file
@ -0,0 +1,16 @@
|
||||
package VL06.Aufgabe01;
|
||||
|
||||
final class Facharbeiter extends Arbeiter {
|
||||
protected String fachRichtung;
|
||||
|
||||
Facharbeiter(int personalNummer, String name, String vorname, double stundenSatz, String fachRichtung) {
|
||||
super(personalNummer, name, vorname, stundenSatz);
|
||||
this.fachRichtung = fachRichtung;
|
||||
}
|
||||
|
||||
void print() {
|
||||
System.out.printf("\n%s, %s (%d):\n", this.getName(), this.getVorname(), this.getPersonalNummer());
|
||||
System.out.printf(" Stundensatz: %.2f Euro\n", this.stundenSatz);
|
||||
System.out.printf(" Fachrichtung: %s\n", this.fachRichtung);
|
||||
}
|
||||
}
|
16
VL06/Aufgabe01/LeitenderAngestellter.java
Normal file
16
VL06/Aufgabe01/LeitenderAngestellter.java
Normal file
@ -0,0 +1,16 @@
|
||||
package VL06.Aufgabe01;
|
||||
|
||||
public class LeitenderAngestellter extends Angestellter {
|
||||
protected double bonus;
|
||||
|
||||
LeitenderAngestellter(int personalNummer, String name, String vorname, double monatsGehalt, double bonus) {
|
||||
super(personalNummer, name, vorname, monatsGehalt);
|
||||
this.bonus = bonus;
|
||||
}
|
||||
|
||||
void print() {
|
||||
System.out.printf("\n%s, %s (%d):\n", this.getName(), this.getVorname(), this.getPersonalNummer());
|
||||
System.out.printf(" Monatsgehalt: %.2f Euro\n", this.monatsGehalt);
|
||||
System.out.printf(" Bonus: %.2f Euro\n", this.bonus);
|
||||
}
|
||||
}
|
17
VL06/Aufgabe01/Manager.java
Normal file
17
VL06/Aufgabe01/Manager.java
Normal file
@ -0,0 +1,17 @@
|
||||
package VL06.Aufgabe01;
|
||||
|
||||
public class Manager extends LeitenderAngestellter {
|
||||
private Dienstwagen dienstwagen;
|
||||
|
||||
Manager(int personalNummer, String name, String vorname, double monatsGehalt, double bonus, String wagentyp, String kennzeichen) {
|
||||
super(personalNummer, name, vorname, monatsGehalt, bonus);
|
||||
this.dienstwagen = new Dienstwagen(wagentyp, kennzeichen);
|
||||
}
|
||||
|
||||
void print() {
|
||||
System.out.printf("\n%s, %s (%d):\n", this.getName(), this.getVorname(), this.getPersonalNummer());
|
||||
System.out.printf(" Monatsgehalt: %.2f Euro\n", this.monatsGehalt);
|
||||
System.out.printf(" Bonus: %.2f Euro\n", this.bonus);
|
||||
this.dienstwagen.print();
|
||||
}
|
||||
}
|
39
VL06/Aufgabe01/Mitarbeiter.java
Normal file
39
VL06/Aufgabe01/Mitarbeiter.java
Normal file
@ -0,0 +1,39 @@
|
||||
package VL06.Aufgabe01;
|
||||
|
||||
abstract class Mitarbeiter {
|
||||
protected int personalNummer;
|
||||
protected String name;
|
||||
protected String vorname;
|
||||
|
||||
Mitarbeiter(int personalNummer, String name, String vorname) {
|
||||
this.personalNummer = personalNummer;
|
||||
this.name = name;
|
||||
this.vorname = vorname;
|
||||
}
|
||||
|
||||
abstract void print();
|
||||
|
||||
public void setPersonalNummer(int personalNummer) {
|
||||
this.personalNummer = personalNummer;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setVorname(String vorname) {
|
||||
this.vorname = vorname;
|
||||
}
|
||||
|
||||
public int getPersonalNummer() {
|
||||
return this.personalNummer;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getVorname() {
|
||||
return this.vorname;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user