Question: Q 1 MyArrayList class implements ArrayListInterface which specifies only a void method addElement that accepts an integer value to be added as an input parameter.

Q1 MyArrayList class implements ArrayListInterface which specifies only a void method addElement that accepts an integer value to be added as an input parameter. MyArrayList operates similar to the array lists.
a) Write the ArrayListInterface.
b) Write the MyArrayList class with the following data fields: Integer values should be stored in an array named storage. capacity data field stores the capacity of the storage array (initially it is 2). numE lements data field stores the number of elements in the array (initially it is 0). All data fields should be private.
c) Write a default constructor which creates the storage array with the default capacity.
d) Write addElement method which places the input integer at the last available position. If the capacity of the array is not sufficient, it calls resize() method to double the size of storage array before addition operation.
e) Write the private void resize method. Do not use any for & for-each loops inside the resize method.
f) Draw UML class diagrams and their relationships for all classes & interfaces.
Q 1 MyArrayList class implements

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!