Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Could somebody please help.! Please DON't copy paste from other places and please read the question and answer exactly what's asked. Thank you I much
Could somebody please help.!
Please DON't copy paste from other places and please read the question and answer exactly what's asked.
Thank you I much appreciate it.
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 classStep 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