Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1.3 Create a new class DynamicArrayStack Modify the class ArrayStack to use a dynamic array. This new class DynamicArrayStack has a constant DEFAULT INC with
1.3 Create a new class DynamicArrayStack Modify the class ArrayStack to use a dynamic array. This new class DynamicArrayStack has a constant DEFAULT INC with the value 25. The constructor takes an argument capacity which is the initial size of the array, but it must always initialize with a minimum of DEFAULT_INC (25). It has a getter, getCapacity0, that returns an integer which is the length of the array. When the array becomes full, a new array is created with size DEFAULT INC more than the previous array and then filled with the elements from the previous array. Similarly, when the array has DEFAULT INC elements less than its capacity, it needs to be automatically reduced in size. Make the necessary changes, particularly in pop, push and clear, and in the constructor (recall, the minimal size of an array is DEFAULT INC) File: . DynamicArrayStack.java public class DynamicArraystack implements Stack
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