make and input
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
parent
e0286e0840
commit
745db43b34
@ -1,13 +1,63 @@
|
||||
public class Compiler {
|
||||
public int add(int i, int j) {
|
||||
return i+j;
|
||||
public class CompilerInput {
|
||||
public int ps;
|
||||
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 void tune(int horsePower) {
|
||||
this.ps = this.ps + horsePower;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public class Node {
|
||||
public void main() {
|
||||
Compiler compiler = new Compiler();
|
||||
int i = compiler.add(5, 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@ compile-javac:
|
||||
compile-miniCompiler:
|
||||
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'"
|
||||
# cp ../main/resources/output/*.class .java/resources/output/miniCompiler
|
||||
|
||||
test: compile-miniCompiler test-miniCompiler
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user