CIS 261 Data Structures

Tiny Queue Project

Programming Exercise

Your assignment is to implement the FIFO Queue ADT, using a C++ int data type to contain the queue elements. In other words, instead of an array or linked structure, one integer variable is used as a queue that can store several integers. One of the main points of this exercise is to impress upon you that abstract data structures need not be implemented in a way that conforms at all to our preconceived notions. Often programmers need to find new and creative (sometimes bizarre) ways to implement the data structures they want to use.

Welcome to Tiny Queue

Valid Elements are 1-9
Valid Operations are:
  [+] EnQueue
  [-] DeQueue
  [F] Front
  [P] PrintQ
  [?] Isempty?
  [Q] Quit

> ?
Tiny Queue is Empty
> + 4
4 Added
> J
Invalid Operation 'J', try [+-FP?Q]
> + 7
7 Added
> P
     4
     7
> F
Front is 4
> -
4 Removed
> ?
Tiny Queue is NOT Empty
> Q

Thanks for using Your Name Here Tiny Queue

You must implement all the queue operations for the FIFO Queue ADT exactly as specified. In addition, you must specify and implement a member function called PrintQueue, which neatly prints the contents of a queue on the screen, in a column, one queue element per line. If the queue is empty, PrintQueue has no output at all. The queue itself must be in the same state after the PrintQueue operation is executed as it was before. The same elements will be in the queue, in the same order.

In designing the data structure, you may assume that the queue elements are integers in the range 1 to 9. Given the size of the elements, you must determine the value of MAX_QUEUE.

Grading for this project will be based on the following:

20

Design & Documentation (including test plan)

10

Code for Main (test driver) Program
40 Code for Queue (tiny queue) Classes

30

Does It Work?