Project description: Your main method should display the following menu repeated
ID: 3542535 • Letter: P
Question
Project description:
Your main method should display the following menu repeatedly:
1. Convert infix to postfix(using a stack).
2. Convert postfix to infix(using a stack).
3. Exit.
Ask the user to input the infix expression or postfix expression according to the option 1 or 2 respectively.
Assume that input strings of infix expression may have parentheses. Also assume that +, -, *, / are the only
operators used and the operands are positive integers. You have to define your Stack collection, called
ArrayStack using underlying array data structure, and it should implement the following StackADT
interface.
public interface StackADT<T>
{
/**
* Adds the specified element to the top of this stack.
* @param element the element to be pushed onto the stack
*/
public void push(T element);
/**
* Removes and returns the top element from this stack.
* @return the element removed from the stack
*/
public T pop();
/**
* Returns without removing the top element of this stack.
* @return the element on top of the stack
*/
public T peek();
/**
* Returns true if this stack contains no elements.
How do I imput a string of numbers into a stack? from there how do I use the stack to do the simple math and how do I get it to print parenthesis and such?
Explanation / Answer
What is the deadline ?
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.