import java.util.*;
public class Main {
public static void main(String[] args) {
String exp = "1 + 2 * (9 - 5)";
SuffixExpression se = compile(exp);
int result = se.execute();
System.out.println(exp + " = " + result + " " + (result == 1 + 2 * (9 - 5) ? "✓" : "✗"));
}
static SuffixExpression compile(String exp) {
// TODO:
return new SuffixExpression();
class SuffixExpression {
int execute() {
return 0;
Sign in to make a reply
Kataknight
import java.util.*;
public class Main {
public static void main(String[] args) {
String exp = "1 + 2 * (9 - 5)";
SuffixExpression se = compile(exp);
int result = se.execute();
System.out.println(exp + " = " + result + " " + (result == 1 + 2 * (9 - 5) ? "✓" : "✗"));
}
static SuffixExpression compile(String exp) {
// TODO:
return new SuffixExpression();
}
}
class SuffixExpression {
int execute() {
// TODO:
return 0;
}