Question: JAVA HELP changing infix to post fix method, calculate method, and helper functions public String infixToPostfix(){ //String postFix = 9 2 * 1 3 *

JAVA HELP

changing infix to post fix method, calculate method, and helper functions

public String infixToPostfix(){

//String postFix = "9 2 * 1 3 * -";

String expression = textfield.getText();

String delims = "+-*/() ";

StringTokenizer strToken = new StringTokenizer(expression, delims, true); while(strToken.hasMoreTokens()){

token = strToken.nextToken();

return postFix;

}

public String calculate() {

String ans = "1";

return ans;

}

// checks if a token is an operator ( [+, -, /, *])

private boolean isOperator(String token) {

return false;

}

// checks if a token is an operand

private boolean isOperand(String token) {

return false;

}

/* checks if the top of the stack has precedence (top of the stack has precedence if topOp >= currentOp), also the stack could be empty

private boolean topHasPrecedence(Stack stack, String currentOperator) {

return false;

}

// takes the two operands and performs the op. Returns the result. (dividing by zero is bad)

private double evaluate(double leftOperand, String operator, double rightOperand) {

return 0.0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!