Add the following methods to the ArrayBoundedStack class, and create a test driver for each to…

Add the following methods to the ArrayBoundedStack class, and create a test driver for each to show that they work correctly. In order to practice your array related coding skills, code each of the methods by accessing the internal variables of the ArrayBoundedStack, not by calling the previously defined public methods of the class.

a. String toString() – creates and returns a string that correctly represents the current stack. Such a method could prove useful for testing and debugging the each

class and for testing and debugging applications that use the class. Assume each stack element already provided its own reasonable toString method.

public class ArrayBoundedStack implements StackInterface
protected final int DEFCAP = 100; // default capacity
protected T[] elements; // holds stack elements
protected int topIndex = -1; // index of top element in stack

public ArrayBoundedStack()
elements = (T[]) new Object[DEFCAP];

public ArrayBoundedStack(int maxSize)
elements = (T[]) new Object[maxSize];

public void push(T element)
// Throws StackOverflowException if this stack is full,
// otherwise places element at the top of this stack.
if (isFull())
throw new StackOverflowException(“Push attempted on a full stack.”);
elements[topIndex] = element;

public void pop()
// Throws StackUnderflowException if this stack is empty,
// otherwise removes top element from this stack.
if (isEmpty())
throw new StackUnderflowException(“Pop attempted on an empty stack.”);
elements[topIndex] = null;

public T top()
// Throws StackUnderflowException if this stack is empty,
// otherwise returns top element of this stack.
T topOfStack = null;
if (isEmpty())
throw new StackUnderflowException(“Top attempted on an empty stack.”);
topOfStack = elements[topIndex];
return topOfStack;

public boolean isEmpty()
// Returns true if this stack is empty, otherwise returns false.
return (topIndex == -1);

public boolean isFull()
// Returns true if this stack is full, otherwise returns false.
return (topIndex == (elements.length – 1));

Calculate the price
Make an order in advance and get the best price
Pages (550 words)
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with Online Academic Experts
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
Human Resources Management (HRM)
My son and I have been sick for two weeks, of course at the end of my semester. I am so grateful that myhomeworkgeeks were able to help! Both papers got A's and I couldn't be more thrilled! Thank you so much and don't forget to tip your writer!
Customer 453077, February 22nd, 2022
Impressive writing
Customer 452547, February 6th, 2021
Thank you so much for your help! :)
Customer 453167, May 11th, 2022
Business and administrative studies
awesome work
Customer 453201, June 15th, 2022
Usually, references need to be within the past 5 years. Thank you :)
Customer 452547, July 16th, 2021
Thank you!!! I received my order in record timing.
Customer 452551, February 9th, 2021
Very fast response and did a excellent job.
Customer 453201, May 31st, 2022
Social Sciences
Very fast report with excellent information on the topic. Thank you for your speedy service in such a short time.
Customer 453213, June 15th, 2022
Looks great and appreciate the help.
Customer 452675, April 26th, 2021
Business Studies
Thank you very much for a good job done and a quick turn around time.
Customer 452615, March 31st, 2021
Criminal Justice
This has been the greatest help while I am recovering from an illness. Thank your team so much.
Customer 452671, May 2nd, 2021
English 101
very good paper thank you.
Customer 453083, February 18th, 2022
Customer reviews in total
Current satisfaction rate
3 pages
Average paper length
Customers referred by a friend
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat
Live ChatWhatsApp