Program #7: Queue


5/5 - (2 votes)

For this assignment, I want you to create and submit a file in which you
implement a queue class. This queue should ONLY have the following operations as defined
in our lectures.
1. Enqueue: insert an item at the end of the queue
2. Dequeue: delete an item from the beginning of the queue (and return it)
3. Peek: return (but do not delete) the item at the beginning of the queue
4. Size: return the size of the queue
5. IsEmpty: return whether the queue is empty
6. IsFull: return whether the queue is full
7. Equals: compare two queues
8. Add: concatenate two queues
In addition, it should have a constructor, a copy constructor, and output capability i.e.
9. Queue()
10. Queue(Queue s)
11. String toString()
You are to build this queue ON TOP of your from Assignment #5. In fact, the
only member variable your queue class will require is a generic list. To do this, make
sure that you have a copy of in the same folder as the file you’re
• For this assignment, you will be provided with two files:
{ contains the main function. You may NOT modify this file!
{ QueueTest.out contains the output from my implementation of the queue. You
would be wise to ensure your output is EXACTLY the same (That includes
spacing and formatting).
• Recall that the only file you will submit is ( If you have implemented it
correctly, It should work with my version of• Label the file by typing your name in a commented section at the top of the
• Compiling should automatically use your and
files (assuming they are in the same directory). After successful compilation, executing
the QueueTest.class file SHOULD produce output identical to QueueTest.out.
• Feel free to redirect the output to a file of your choosing, and then compare the two files
(i.e. QueueTest.out, and your output file) using the command prompt. For example,
once completed, the three commands below should NOT produce any output.
java QueueTest myOutput
diff QueueTest.out myOutput
java QueueTest myOutput
fc QueueTest.out myOutput

PlaceholderProgram #7: Queue
Open chat
Need help?
Can we help?