Upload files to "Aufgaben"

This commit is contained in:
2025-07-29 08:22:16 +02:00
parent 899a05907b
commit a4e0e88d93
5 changed files with 108 additions and 0 deletions

Binary file not shown.

Binary file not shown.

63
Aufgaben/Auto.java Normal file
View 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
View 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
View 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