You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are to implement a class in the src/main/java folder called "DynamicIntArray"
The class has the following protected member variables
array - this is of type int[]
elements - this is of type int
The class has one constructor that takes a single int argument called "initialSize".
The constructor initializes the array member variable to a int[] of the given initialSize.
The elements member variable is set to 0.
The class implements two public methods:
append - takes a single int argument num which is the number that should be appended TO THE END OF THE ARRAY. If the array is full, double the size of the array and copy all elements into the newly resized array.
popIndex - takes a single int argumentindex which is the index in the array that you should return (if it exists). If that index does not exisit OR the number of elements that have been added should not have reached that index, it throws an IndexOutOfBoundsException. Once the element is removed, move all elements to the right of it back one index to make the array continuous again.
Testing
Option 1
Checkout this repository
Create a new branch called "[student-name]-sol"
Implement the above.
Call git push -u origin HEAD (the first time) - subsequent times just call git push.
In github, click the actions tab. You will see your tests run
Option 2
Checkout this repository
Run ./gradlew test (linux) ./gradlew.bat test (windows) - results will be displayed.