Given a string with only numbers, math operators, and "x", and a number to replace x, how would you replace all x in the string and then equate the string into an answer? So far, I have is this:
String str = "2+4x"; //Example string, could be [2 +4x - 5/ 4 - 9( 6+1*x)] or [4x+0]
Float numToReplace = 20.4; //Has to be Float, cannot use Double
str = str.replace("x", numToReplace);
// How to simplify the string into a number?
I can't equate the string, and I also cannot figure out how to get rid of "implied multiplication" (when the user inputs "2x", I would want to change this to (2*x) in order for the equation to work properly after replacing x).