A
String variable references a mathematical equation. Within a method called convertToPostFix(String s), I am analyzing each character in the equation as follows:
Within this method, I loop through the entire string and push digits to the stack until an operator is found, if no operator is currently in the stack, push(operator). If a right parenth is found, pop all the elements in the stack to an output string. Alternatively, if an operator is found to exist in the stack already, I check the stack precedence with the following method:
I'm really not sure if I'm doing this correctly, or if I am way off. My output is incorrect and looks something like this : (1053
Is this the correct use of the stack?