Question: please help import java.util.Arrays; public class ArrayList { 1/class variables private int numElements = 0; private int currCap = 100; private Object'l list = new

import java.util.Arrays; public class ArrayList { 1/class variables private int numElements = 0; private int currCap = 100; private Object'l list = new Object (100); public void insert(Object obj, int index) { 1/extends the ArrayList if current capacity is reached if(numElements == list.length) { currCap*=2; list = Arrays.copyof(list, currCap); } //bumps all current elements up 1 index to make room for new object for(int i = numElements; i > index; i--){ list[i] = list[i-1]; //adds object list[index] = obj: numElements++://tracks number of elements } public void add(Object obj){ 1/expands the ArrayList if the current capacity is reached if(numElements == list. length) { currCap*=2; list = Arrays.copyof(list, currCap); } 1/adds the object to the farthest index list (numElements] = obj; numElements++; public Object remove(int index) { Object item = list[index]; for(int i = index; i
Step by Step Solution
There are 3 Steps involved in it
To modify the ArrayList class and build an ExpenseAccount class that extends it youll implement the Cloneable and Iterable interfaces Youll make the A... View full answer
Get step-by-step solutions from verified subject matter experts
