Consider the interface below: import java.util.NoSuchElementException; public interface MyList { public int getSize(); public void insert(E data) throws ListOverflowException; public E getElement(E data) throws NoSuchElementException; public boolean delete(E data); // returns false if the data is not deleted in the list public boolean search(E data); // returns index of data, else -1 is return } a. Use an array object to store the elements of the list object. The program should be able to show its size, get element, delete, and search from the array. b. This array object will have a fixed size of five (5) and that an attempt to insert an element into the array when full will result to a ListOverflowException.
Consider the interface below:
import java.util.NoSuchElementException;
public interface MyList<E> {
public int getSize();
public void insert(E data) throws ListOverflowException;
public E getElement(E data) throws NoSuchElementException;
public boolean delete(E data); // returns false if the data is not deleted in the list
public boolean search(E data); // returns index of data, else -1 is return
}
a. Use an array object to store the elements of the list object. The program should be able to show its size, get element, delete, and search from the array.
b. This array object will have a fixed size of five (5) and that an attempt to insert an element into the array when full will result to a ListOverflowException.
Step by step
Solved in 2 steps