Within Java. Create an ExpandableArray class. There should be methods add, get,
ID: 648946 • Letter: W
Question
Within Java. Create an ExpandableArray class. There should be methods add, get, set, and size. The methods should work like the identically named methods in an ArrayList. Internally the ExpandableArray should have an int array with two slots initally. The size method should return the net number of integers added- not the number of slots in the internal array. Initially size should be zero. If on a call of add the internal array is full, the add method should:
a) Create a new array with twice the number of slots as the current array.
b)Copy the contents of the original array to the new array, and thereafter use the new array until it is not big enough
Write a program that uses the ExpandableArray class it should:
1)Create an ExpandableArray object.
2)Add 1,2,99,4,6,7,8,9, and 10, in that order
3)Set 99 to 3.
4)Insert 5 after the number 4
5)Display the current size
6)Display the integers stored by calling get within a for loop