Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
Maximilian Stahl 2024-07-05 13:46:31 +02:00
commit 51a390752b
2 changed files with 61 additions and 12 deletions

View File

@ -1,13 +1,63 @@
public class Compiler { public class CompilerInput {
public int add(int i, int j) { public int ps;
return i+j; public char brand;
public int tires;
public int drivenKilometers;
public CompilerInput(int horsePower) {
this.ps = horsePower;
this.tires = 4;
}
public int getTires() {
return this.tires;
}
public boolean isSuperCar() {
if(this.ps > 300) {
return true;
} else {
return false;
} }
} }
public class Node { public void tune(int horsePower) {
public void main() { this.ps = this.ps + horsePower;
Compiler compiler = new Compiler(); }
int i = compiler.add(5, 8);
public void tune() {
this.ps = this.ps + 50;
}
public void driveCircels(int circels) {
for(int i = 0; i < circels; i++) {
this.drivenKilometers = this.drivenKilometers + 5;
} }
} }
public void isTunable(boolean hasEngine, boolean hasTires) {
if(hasEngine && hasTires) {
this.tune(5);
}
}
public char race() {
int enemyHorsePower = 200;
char win = 'W';
char lose = 'L';
CompilerInput enemy = new CompilerInput(ps);
if(this.ps > enemyHorsePower) {
return win;
} else {
return lose;
}
}
public int refuel(int currentTank, int maxTank){
int tank = currentTank;
do{
tank++;
}while(tank<maxTank);
return tank;
}
}

View File

@ -10,7 +10,6 @@ compile-javac:
compile-miniCompiler: compile-miniCompiler:
cd ../.. ; mvn -DskipTests install cd ../.. ; mvn -DskipTests install
cd ../.. ; mvn exec:java -DgenJar=true -DgenClass=true -Dexec.mainClass="main.Main" -Dexec.args="'src/main/resources/input/CompilerInput.java' 'src/main/resources/output'" cd ../.. ; mvn exec:java -DgenJar=true -DgenClass=true -Dexec.mainClass="main.Main" -Dexec.args="'src/main/resources/input/CompilerInput.java' 'src/main/resources/output'"
# cp ../main/resources/output/*.class .java/resources/output/miniCompiler
test: compile-miniCompiler test-miniCompiler test: compile-miniCompiler test-miniCompiler