Enhance the definition of the class partially filled array


Question: Enhance the definition of the class Partially Filled Array in the following way: When the user attempts to add one additional element and there is no room in the array instance variable a, the user is allowed to add the element. The object creates a second array that is twice the size of the array a, copies values from the array a to the user's new array, makes this array (or more precisely its reference) the new value of a, and then adds the element to this new larger array a . Hence, this new class should have no limit (other than the physical size of the computer) to how many numbers it can hold. The instance variable max Number Of Elements remains and the method get Max Capacity is unchanged, but these now refer to the currently allocated memory and not to an absolute upper bound. Write a suitable test program.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Enhance the definition of the class partially filled array
Reference No:- TGS02404604

Now Priced at $10 (50% Discount)

Recommended (92%)

Rated (4.4/5)