Question: PLS HELP have most of my code but keep getting this error! Heres my code / / Complete the implementation of your MyArrayList class in

PLS HELP have most of my code but keep getting this error!
Heres my code
// Complete the implementation of your MyArrayList class in this file
import java.util.NoSuchElementException;
public class MyQueue implements IQueue {
private Object[] queueArray;
private int front;
private int rear;
private int size;
public MyQueue(){
queueArray = new Object[10];
front =0;
rear =-1;
size =0;
}
public void enqueue(Object item){
if (size == queueArray.length){
resizeArray();
}
// Add the item to the rear of the queue
rear =(rear +1)% queueArray.length;
queueArray[rear]= item;
size++;
}
public Object dequeue(){
if (isEmpty()){
throw new NoSuchElementException("Queue is empty");
}
// Remove and return the item from the front of the queue
Object item = queueArray[front];
queueArray[front]= null; // Clear the reference
front =(front +1)% queueArray.length;
size--;
return item;
}
public Object peek(){
if (isEmpty()){
throw new NoSuchElementException("Queue is empty");
}
return queueArray[front];
}
public int indexOf(Object item){
for (int i =0; i size; i++){
int index =(front + i)% queueArray.length;
if (queueArray[index]!= null && queueArray[index].equals(item)){
return i;
}
}
return -1;
}
public int getSize(){
return size;
}
public boolean isEmpty(){
return size ==0;
}
private void resizeArray(){
int newCapacity = queueArray.length *2;
Object[] newArray = new Object[newCapacity];
for (int i =0; i size; i++){
newArray[i]= queueArray[(front + i)% queueArray.length];
}
queueArray = newArray;
front =0;
rear = size -1;
}
} Additional Information
MyQueue
1. This concrete class will store its elements in either an internal array list or linked list. All such implementation details must be contained in your myQueue . java file. You may add any additional fields, methods, and inner classes that you will need to achieve this.
2. enqueuemethod
- Add a new item to end of the queue. For example: given the queue \(\{1,2,3\}\)(where the value 1 is at the front and the value 3 is currently at the back) and an instruction to enqueue (99), the result would be this \(\{1,2,3,99\}\), with the value 99 now at the end of the queue.
3. dequeuemethod
- Remove and return the item currently at the front of the queue. For example: given the queue \(\{1,2,3\}\)(where the value 1 is at the front and the value 3 is currently at the back) and an instruction to dequeue (), the queue would now look like this \(\{2,3\}\), and the value 1 would be returned.
- Throws a NoSuchElementException if the queue is currently empty when this method is called.
4. peekmethod
- Return (but do not remove) the item currently at the front of the queue. For example: given the queue \(\{1,2,3\}\)(where the value 1 is at the front and the value 3 is currently at the back) and an instruction to peek (), the queue would still look like this \(\{1,2,3\}\), and the value 1 would be returned.
- Throws a NoSuchElementException if the queue is currently empty when this method is called.
5. indexOfmethod
- Return the (zero-based) number of elements from the front or top of the collection where the specified item is first found. Returns -1 if the item is not found in the collection. For example: given the queue \(\{1,2,3\}\)(where the value 1 is at the front and the value 3 is currently at the back) and the instruction indexOf (2), the value 1 would be returned (because the value 2 was found at index 1(1 element after the front) in the queue. For another example: given the queue \(\{1,2,3\}\)(where the value 1 is at the front and the value 3 is currently at the back) and the instruction indexOf (99), the value -1 would be returned (because the value 99 is not found in the queue).
6. sizemethod
- Returns the number of elements currently stored in the queue.
7. isEmptymethod
- Returns true if there are currently no items stored in this queue, otherwise returns false. ```
./MyQueue.java:3: error: MyQueue is not abstract and does not override abstract method siz
e() in IQueue
public class MyQueue implements IQueue {
1 error
\
```
PLS HELP have most of my code but keep getting

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!