executor 2 change

This commit is contained in:
rahimiankeanu
2021-11-02 21:21:52 +01:00
parent d08a6d0b67
commit dacb5605d7
4 changed files with 25 additions and 12 deletions

View File

@@ -18,19 +18,28 @@ public class Executor extends ExecutorBase {
@Override
protected
String execution() {
String execution(String... input) {
double result = Double.NaN;
int a = Integer.parseInt(input[0]);
int b = Integer.parseInt(input[2]);
String operation = input[1];
int a = 20;
int b = 20;
try {
TimeUnit.SECONDS.sleep(20);
} catch (InterruptedException e) {
e.printStackTrace();
}
int result = a + b;
if (operation == "+") {
result = a + b;
} else if (operation == "*") {
result = a * b;
} else if (operation == "-") {
result = a - b;
}
return Integer.toString(result);
return Double.toString(result);
}
}
}