Question: IN JAVA PLEASE! Please answer in java 1. Download the files from the StackExercise folder in Files on canvas. 2. Write a tostring method for

IN JAVA PLEASE! IN JAVA PLEASE! Please answer in java 1. Download the files

Please answer in java

1. Download the files from the StackExercise folder in Files on canvas. 2. Write a tostring method for the ArrayBoundedStack class. We will use this in our test program to make sure that the stack methods are creating a correct stack; it is not part of the ADT. The tostring method should return all items on the stack from bottom to top (use newlines to place each item on a separate line, and indent the items to make it easier to read). 3. Write a main method which contains a stack of Strings. Prompt the user for the type of stack to create: default size or specified size. If the user wants to specify the size, prompt for the size. Create the stack and write a loop with a menu that gives the user the following options: - enter a String from the keyboard and push the String onto the stack - print the item on top of the stack - pop an element from the stack - print the stack - exit 4. Run your program to test the stack class. Use the menu options to enter and remove values and make sure that all methods are functioning correctly. 5. Add a method public T Toppop () that pops and returns the element on the top of the stack. The method should throw a StackUnderflowException if the stack is empty. Add a menu item to your main method to call this function and print the element that is returned. Run your program to test this method

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!