Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a stack interface called, StackInterface . You must use generics for this interface. (push(newEntry), pop(), peek(), isEmpty, clear()) In this interface you are required

Create a stack interface called, StackInterface . You must use generics for this interface. (push(newEntry), pop(), peek(), isEmpty, clear()) In this interface you are required to include the javadoc for the preconditions and postconditions for each method.

Write two classes that implement StackInterface

ArrayStack: the stack is implemented using an array.

LinkedStack: the stack is implemented using a singly linked data chain

Write a class that converts an infix expression to a postfix expression using the algorithm. Name this class InfixToPostfixConverter and it should implement the interface, ExpressionConverterInterface (which will be provided)

public interface ExpressionConverterInterface { /** convert method converts one type of expression format to another * @param expression The expression to be converted * @return The expression in the new format * @throws InvalidExpressionException If the expression to be converted has syntax errors */ String convert(String expression) throws InvalidExpressionException; } 

This class should have a default constructor and a constructor that takes an object of type StackInterface as its only parameter.

If the default constructor is used, then the private member (of type StackInterface) should be initialized to a new LinkedStack

If the other constructor is used then you should set your internal StackInterface reference variable to point to the object passed in by parameter.

Write one final class named, InvalidExpressionException that extends RuntimeException. This class does not need any methods to be implemented, It is simply the exception that will be thrown by one of ExpressionConverterInterface methods

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PC Magazine Guide To Client Server Databases

Authors: Joe Salemi

1st Edition

156276070X, 978-1562760700

More Books

Students also viewed these Databases questions

Question

Enumerate the benefits of depositary receipts to the issuers.

Answered: 1 week ago