/** * Add description of the program here */ import static dit948.SimpleIO.*; /** * @author Musard Balliu * * @date Sep 9, 2015 * */ public class InfixToPostfix { /** * This subroutine/method/function takes as input a character c * and returns an integer (0 or 1) corresponding to the priority of operator c * -1 it returned whenever c is not an operator. */ static int p(char c){ if ((c=='+') || (c=='-')) { return 0; } else if ((c=='/') || (c=='*')) { return 1; } else { return -1; } } /** * Describe here what this subroutine is doing */ static String infixToPostfix(String infix){ String postfix = ""; //Write the code to implement Task 1 return postfix; } /** * Describe here what this subroutine is doing */ static int eval(String postfix){ int result = 0; //Write the code to implement Task 2 return result; } /** * This is the main method. It should implement the main task */ public static void main(String[] args) { String infix=""; // Write code to implement main task //call subroutine infixToPostfix String postfix = infixToPostfix(infix); // call subroutine to implement postfix int result = eval(postfix); // print the result to the user and repeat everything whenever // he/she wants to continue } }