In java, I am currently in the process of trying to find a way to do mathematical sums by typing in text to a JTextField, putting it into a String, and converting it to an int a
This will do it for you.
import javax.script.ScriptEngineManager;
import javax.script.ScriptEngine;
public class Test {
public static void main(String[] args) throws Exception{
ScriptEngineManager mgr = new ScriptEngineManager();
ScriptEngine engine = mgr.getEngineByName("JavaScript");
String foo = "40+2";//any mathematical operations +,-,*,/
System.out.println(engine.eval(foo));
}
}
Here you can put the methods describing the log/cos etc functions
String st = "10+3";
int result;
for(int i=0;i