Hi,
Suppose I have three boolean variables a,b and c that can be used along with the relational and boolean operators to make an expression that has to be evaluated by an if statement.
Now, Suppose The Operators involved are selected by means of radio buttons from the front end.
For eg : a OP1 b OP2 c
Values of OP1 and OP2 are got from a set of radio button selections made by the user.
Now,
I can get the selected operators in the following manner:
String op1=(cmb1[0].getSelectedItem()).toString();
String op2=(cmb1[1].getSelectedItem()).toString();
Now,
I have want the expression
if(a OP1 b OP2 c)
to be evaluated dynamically according to above user choices...and I don't want to use an if ladder for all the permutations involving
a,b,c and the different values that OP1 and OP2 can take.
Please suggest some methods to do this.
Thank You.