Ques is (Given the following implementation of a partially-filled sorted array (PFSA),
- Write a method named ‘insert’ that is passed an int value. The method inserts the value into the array appropriately so that the array is always sorted in ascending order. Your method should resolve an attempt to add to when at max capacity with ArrayIndexOutOfBoundsException.
- write a method named ‘seekAndDestroy’ which is passed an int value. The method finds the value in the partially-filled array, and deletes it. The partially-filled array must then be adjusted to not leave a gap in the data. Your method should throw a custom exception called DataNotFoundExceptionwith an appropriate message if the data is not in the array, and therefore can not be deleted. Include the data value in this message.
Requirements are as followed –
** use the following libraries if needed**
use readObject() and writeObject Methods from library if needed