
Untitled
By: a guest on
May 11th, 2012 | syntax:
None | size: 0.63 KB | hits: 14 | expires: Never
How to do mathematical calculation in java based on user input string? [closed]
String EXPRESION = null;
EXPRESION = JOptionPane.showInputDialog("Please enter expresion for dy/dx");
double x = 1.4;
double y = 5;
double output = HERE IS THE PROBLEM
JOptionPane.showMessageDialog("The value is" +output);
import jscheme.JS;
String query = "(+ 10 20)";
System.out.println(query + " = " + JS.eval(query));
import bsh.*;
class Operation
{
public static void main(String[] args)throws Exception
{
Interpreter i=new Interpreter();
int r=(Integer)i.eval(args[0]);
System.out.println(r);
}
}