Question
Java public interface ArrayStackADT { /** Adds one element to the top of this stack. * @param dataItem data item to be pushed onto stack
Java
public interface ArrayStackADT
/** Returns without removing the top element of this stack. * @return T data item on top of the stack */ public T peek() throws EmptyStackException; /** Returns true if this stack contains no elements. * @return true if the stack is empty; false otherwise */ public boolean isEmpty();
/** Returns the number of data items in this stack. * @return int number of data items in this stack */ public int size();
/** Returns a string representation of this stack. * @return String representation of this stack */ public String toString(); }
1.1 Valid Paths When looking for a path the program must satisfy the following conditions: The path can go from the WPC cell or from an omni switch cell to the following neighboring cells: o the customer cell o an omni switch cell o the north cell or the south cell, if such a cell is a vertical switch o the east cell or the west cell, if such a cell is a horizontal switch. The path can go from a vertical switch cell to the following neighboring cells: . o The north cell or the south cell, if such a cell is either the customer cell C, an omni switch cell or a vertical switch cell The path can go from a horizontal switch cell to the following neighboring cells: . o The east cell or the west cell, if such a cell is either the customer cell C, am omni switch cell, or a horizontal switch cell. If while looking for a path the program finds that from the current cell there are several choices as to which adjacent cell to use to continue the path, your program must select the next cell for the path in the following manner: the program prefers the customer cell over the other cells; if there is no customer cell adjacent to the current cell, then the program must prefer the omni switch cell over the other cells; if there is no omni switch cell the program chooses the smallest indexed cell that satisfies the conditions described above * e 2. Classes to Implement A description of the classes that you need to implement in this assignment is given below. You can implement more classes, if you want. You cannot use any static instance variables. You cannot use java's provided Stack class or any of the other java classes from the java library that implements collections. The data structure that you must use for this assignment is an array, as described in Section 2.1 ArrayStack.java This class implements a stack using an array. The header of this class must be this public class ArravStack
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started