1. Represent each of the following infix expressions as a postfix expression:

1. (a+ b)/ (c- d)
2. a/(b-c)*d
3. a-(b/(c-d)*e+f)^g
4. (a-b*c)/(d*e^f*g+h)

2. Implement all the methods of the StackInterface (discussed in lesson) in class Stack. Create a demo class to test all methods using string as a datatype.


public interface StackInterface< T> {

/**
* Adds a new entry to the top of this tack.
*
* @param newEntry An object to be added to the stack.
*/
public void push(T newEntry);

/**
* Removes and returns this stack's top entry.
*
* @return The object at the top of the stack.
* @throws EmptyStackException if the stack is empty before the operation.
*/
public T pop();

/**
* Retrieves the stack's top entry.
*
* @return The object at the top of the stack.
* @throws EmptyStackException if the stack is empty.
*/
public T peek();

/**
* Detects whether this stack is empty.
*
* @return True if the stack is empty.
*/
public boolean isEmpty();

/**
* Removes all entries from this stack.
*/
public void clear();
}
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.