Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

Interface:import java

Computer Science Sep 03, 2020

Interface: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);

}

Other than creating the interface shown above, the ListOverflowException class will have to be created. NoSuchElementException class is accessed from java.util package.

Filename: MyList.java

 

HELP:

Create implementations of the above interface in different ways as stipulated below.

a. Use an array object to store the elements of the list object. 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.

Filename: MyFixedSizeArrayList.java

 

b. Use an array object to store the elements of the list object. Although the initial size of the array is 5, this differs from the first situation because if the array is full and an element is to be inserted, a new array object with a size that is twice than the "old" array will be created. All the elements of the "old" array will be copied to the new array before inserting the new element. You may refer to the illustration below.

Filename: MyGrowingArrayList.java

 

1.png

Expert Solution

For detailed step-by-step solution, place custom order now.
Need this Answer?

This solution is not in the archive yet. Hire an expert to solve it for you.

Get a Quote
Secure Payment