Is it possible to pass arithmatic operators to a method in java?
- by user349611
Right now I'm going to have to write a method that looks like this:
public String Calculate(String Operator, Double Operand1, Double Operand2)
{
if (Operator.equals("+"))
{
return String.valueOf(Operand1 + Operand2);
}
else if (Operator.equals("-"))
{
return String.valueOf(Operand1 -…