About java designed calculator | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

About java designed calculator

HELLO, I'm trying to find best method of advanced calculator and I want ask you that, is it poasible to create input method without Strings and its methods, which user can write and use fast as programme can write in ide double a=(8+6*4.14) Thanks for answers

26th Jan 2019, 9:41 AM
Jahongir Anasov
Jahongir Anasov - avatar
4 Answers
+ 13
Just take input in a text box then u can use built-in JavaScriptEngineManager to eval it. U need to import javax.script*; Something like this: Suppose someone enter 3+8*6 in textbox then we will get textbox value in a string. String s = textBox.getText().toString(); ScriptEngine engine = new ScriptManager().getEngineByName("JavaScript"); System.out.println(engine.eval(s)); Hope this solves the problem
26th Jan 2019, 10:17 AM
Sick L̲̅i̲̅n̲̅e̲̅🌡️[TheBraveCoders]
Sick L̲̅i̲̅n̲̅e̲̅🌡️[TheBraveCoders] - avatar
+ 8
I'm not sure what you're asking here. But i guess yes it's possible
26th Jan 2019, 9:46 AM
Sick L̲̅i̲̅n̲̅e̲̅🌡️[TheBraveCoders]
Sick L̲̅i̲̅n̲̅e̲̅🌡️[TheBraveCoders] - avatar
0
I mean if you are programmer you can write in intellij idea or netbeans such that System.out.println(3+8*6); And answer will come instantly. But in graphic interface I thought whole day but couldn't find
26th Jan 2019, 9:49 AM
Jahongir Anasov
Jahongir Anasov - avatar
0
I will try
26th Jan 2019, 10:49 AM
Jahongir Anasov
Jahongir Anasov - avatar