Using the algorithm convertToPostfix given in photo below, create a class in jav
ID: 3678187 • Letter: U
Question
Using the algorithm convertToPostfix given in photo below, create a class in java that will convert each of thefollowing infix expressions to postfix expressions for the test cases a-d:
a. a * b / (c -d)
b. (a -b * c) / (d * e * f + g)
c. a / b * (c + (d -e))
d. (a ^ b * c -d) ^ e + f ^ g ^ h
, ollowing algorithm encompasses the previous observations s in our expression are single-letter variables. process. For simplicity, all operand Algorithm convertToPostfix(infix) // Converts an infix expression to an equivalent postfix expression operatorStack - a new empty stack postfix = a new empty string while Cinfix has characters left to parse) nextCharacter next nonblank character of infix switch (nextCharacter) case variable: Append nextCharacter to postfix break case 'A' operatorStack.push(nextCharacter) break case +'case ' casecase while (loperatorStack.isEmptyO and O) precedence ofnextCharacter precedence of operatorStack.peek Append operatorStack.peek O to postfix operatorStack.popC operatorStack.push (nextCharacter) break case' operatorStack.push(nextCharacter) break case)' :11 Stack is not empty if infix expression is valid topoperator = operatorStack.pop() while (topOperatorC)