πŸ”– Background Information

A queue is a data structure that follows a first-in first-out (FIFO) principle. Similar to the stack you can add elements to the queue (enqueue), remove elements from the queue (dequeue), and check if the queue is full.

🎯 Problem Statement

Write a queue data structure that stores β€œcute” objects. A cute object is an object that conforms to the Cutie interface / abstract base class (as outlined in the Dev Notes). You can use an array β€œunder the hood”, meaning that your queue will have a maximum size.

βœ… Acceptance Criteria

  • The queue data structure should be an object.
  • The queue should use an array list β€œunder the hood” to store Cutie objects. You do not need to create a queue that resizes itself with new inputs.
  • I should be able to enqueue(...) and dequeue(...) a Cutie object to the queue data structure.
  • If I try to enqueue an object onto the queue while it is full, I should see a message telling me the queue is full. The queue should remain unchanged.
  • I should be able to get the current size of the queue via a size(...) method (i.e. how many elements are in the queue).
  • You do not have to implement a generic queue structure. You can instead have it store Cutie objects directly. There is an extra credit opportunity to make the queue generic.

πŸ“‹ Dev Notes

  • You cannot use the built-in queue in this solution.
  • You do not have to implement the Cutie interface / abstract base class from scratch. I have provided it here:

πŸ–₯️ Example Output

Suppose you wrote a queue data structure called QueueTees. You then created Puppy, Kitty, and PygmyMarmoset which all conform to that interface / abstract base class. Your driver program might look something like this:

πŸ“ Thought Provoking Questions

  1. How might you create a queue with no theoretical maximum size?
  2. Right now, your queue is restricted to store Cutie objects only. How might you change your queue class to store a variety of different types of objects?

πŸ’Ό Optional Extra Credit

(1/4 Point) Clear Method

Create a method that clears all elements in the queue.

(1/2 Point) Generic Queue

Update your queue class to allow the user to specify what type of object will be stored in the queue. You can use a class template to specify the type of object. The behavior of your queue should not change otherwise.

πŸ“˜ Works Cited

N/A