Avila University innerQueue Java Program Project

Avila University

Question Description

I’m trying to learn for my Programming class and I’m stuck. Can you help?

Using the given generic class, complete the class.

It should contain the following attributes:

E[] innerQueue – The array that will hold the contents of the innerQueue.

As well as the following constructors/methods:

MyQueue(): constructor – Initializes innerQueue to be a queue with a length of 0.

add(E item): void – Inserts the element into the end of queue. The array is resized using a copy of innerQueue that’s one element larger.

peek(): E – Returns the value at the head of the queue without removing it, returning null if the queue is empty.

poll(): E – Retrieves and removes the head of the queue, returning null if the queue is empty. The array is resized using a copy of innerQueue that’s one element smaller.

When finished, you can use the main method located inside to test your methods.

Unformatted Attachment Preview

Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

I created the second version of the program which actually uses generic array E[]. But it requires some ...

Borys_S (7934)
Rice University

Top quality work from this tutor! I’ll be back!

Heard about Studypool for a while and finally tried it. Glad I did caus this was really helpful.

Thank you! Reasonably priced given the quality