I am trying to calculate a formula with java but when I try to use a conditional, to do one thing or another according to whether a parameter is true or false. I add method.
public void calcular (){
Calculable calc = null;
try {
calc = new ExpressionBuilder("(4-2)/100").build();
} catch (UnknownFunctionException e) {
e.printStackTrace();
} catch (UnparsableExpressionException e) {
e.printStackTrace();
}
double result1=calc.calculate();
}
This works perfect but when I try to put something like that in the expression it does not work:
(30>20 ? 3+2 : (4-2)/100); //esto por ejemplo.
Any ideas?