I'm trying to make a function that takes a String and a double as parameters in Java, like this:
public static double calc(String fx, double arg) {
return fx.convertToFunction(arg); // Pseudocode
}
For instance, to calculate the cosine of a number (PI, for example), the code would be:
calc("cos", Math.PI);
and the function calc has to convert "cos" into Math.cos().
Is that at least possible?