Upload files to "Aufgaben"
This commit is contained in:
BIN
Aufgaben/01_Hamster_Einführung.pdf
Normal file
BIN
Aufgaben/01_Hamster_Einführung.pdf
Normal file
Binary file not shown.
BIN
Aufgaben/02_Hamster_Variablen.pdf
Normal file
BIN
Aufgaben/02_Hamster_Variablen.pdf
Normal file
Binary file not shown.
63
Aufgaben/Auto.java
Normal file
63
Aufgaben/Auto.java
Normal file
@@ -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
|
||||
36
Aufgaben/Auto.uml
Normal file
36
Aufgaben/Auto.uml
Normal file
@@ -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=
|
||||
|
||||
9
Aufgaben/AutoAufruf.java
Normal file
9
Aufgaben/AutoAufruf.java
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user