Question: Could somebody please help with the MyArrayStack.java class. You are to write a program name MyArrayStack.java that create/build the ArrayStack data structure. The class must
Could somebody please help with the MyArrayStack.java class.


You are to write a program name MyArrayStack.java that create/build the ArrayStack data structure. The class must be written to accept any type of Objects. The following must be implemented i.e. YOU must write the code (do not import any stack from the Java Library): 1. One default constructor that will create an MyArrayStack object with a default size (capacity) of 10 ------ public MyArrayStack (); 2. Another constructor that accepts a parameter of type int and sets the size to this parameter ---- public MyArrayStack(int n); 3. A method that allows you to push a new object in MyArrayStack ---- public Boolean push(Object x); 4. A method that allows you to delete the object from MyArrayStack ---- public Object pop(); 5. A method that allows you to access the object in the top of MyArrayStack ---- public Object peek(); 6. A method would test to see if the MyArrayStack is empty ---- public boolean isEmpty(); Now, write a driver program TestStack.java, which has two method: 1. public static void main(String[] args); 2. public boolean TestL(String S); Note: 1: In public static void main(String[] args), you need to ask user to enter the string s first, then call the Testl(s) to test the string. You should also output the decision. 2: The method public boolean TestL(String S) is used to test whether string S is in the language: L={w$w: w is a string of characters other than $, w=reverse(w)} 3: you need to use Character class of char, wrapper class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
