diff --git a/Aufgaben/01_Hamster_Einführung.pdf b/Aufgaben/01_Hamster_Einführung.pdf new file mode 100644 index 0000000..47a3c85 Binary files /dev/null and b/Aufgaben/01_Hamster_Einführung.pdf differ diff --git a/Aufgaben/02_Hamster_Variablen.pdf b/Aufgaben/02_Hamster_Variablen.pdf new file mode 100644 index 0000000..e853c0d Binary files /dev/null and b/Aufgaben/02_Hamster_Variablen.pdf differ diff --git a/Aufgaben/Auto.java b/Aufgaben/Auto.java new file mode 100644 index 0000000..def1f7c --- /dev/null +++ b/Aufgaben/Auto.java @@ -0,0 +1,63 @@ +public class Auto { + + // Anfang Attribute + private String Farbe; + private int leistung; + private int anzTueren; + private String Hersteller; + // Ende Attribute + + public Auto(String Farbe, int leistung, int anzTueren, String Hersteller) { + this.Farbe = Farbe; + this.leistung = leistung; + this.anzTueren = anzTueren; + this.Hersteller = Hersteller; + } + + // Anfang Methoden + public String getFarbe() { + return Farbe; + } + + public void setFarbe(String FarbeNeu) { + Farbe = FarbeNeu; + } + + public int getLeistung() { + return leistung; + } + + public void setLeistung(int leistungNeu) { + leistung = leistungNeu; + } + + public int getAnzTueren() { + return anzTueren; + } + + public void setAnzTueren(int anzTuerenNeu) { + anzTueren = anzTuerenNeu; + } + + public String getHersteller() { + return Hersteller; + } + + public void setHersteller(String HerstellerNeu) { + Hersteller = HerstellerNeu; + } + + public void tuning(int leistungNeu) { + double leistungMax = leistung * 0.2; + + if(leistungNeu < leistungMax){ + leistung += leistungNeu; + System.out.println("Das Tuning wurde durchgeführt, das Auto hat jetzt " + leistung + "PS"); + } + else{ + System.out.println("Das Tuning übersteigt die Möglichkeiten des Fahrzeugs. Es können maximal " + leistungMax + "PS hinzukommen!"); + } + } + + // Ende Methoden +} // end of Auto diff --git a/Aufgaben/Auto.uml b/Aufgaben/Auto.uml new file mode 100644 index 0000000..14c3cd9 --- /dev/null +++ b/Aufgaben/Auto.uml @@ -0,0 +1,36 @@ +[Files] +File0=Auto.java +File1=AutoAufruf.java + +[Box: - Auto] +X=20 +Y=40 +MinVis=0 +ShowParameter=4 +SortOrder=0 +ShowIcons=1 + +[Box: - AutoAufruf] +X=647 +Y=244 +MinVis=0 +ShowParameter=4 +SortOrder=0 +ShowIcons=1 + +[Diagram] +comments=0 +OffsetX=0 +OffsetY=0 +Visibility=0 +ShowParameter=4 +SortOrder=0 +ShowIcons=1 +ShowConnections=0 +Fontname=Segoe UI +Fontsize=12 +ShowObjectDiagram=0 + +[Interactive] +I0= + diff --git a/Aufgaben/AutoAufruf.java b/Aufgaben/AutoAufruf.java new file mode 100644 index 0000000..db378bd --- /dev/null +++ b/Aufgaben/AutoAufruf.java @@ -0,0 +1,9 @@ +public class AutoAufruf { + public static void main(String args[]){ + Auto car = new Auto("Rot", 140, 5, "GHSE"); + + System.out.println("Das Auto von " + car.getHersteller() + " ist " + car.getFarbe() + ", hat " + car.getLeistung() + "PS und " + car.getAnzTueren() + " Türen."); + car.tuning(40); + car.tuning(25); + } +} // end of AutoAufruf