CS 112
Homework 7
Due: Wednesday 11/8/2000 by 12:00 a.m.
The Problem, general description
Your task is to write a program to manage a queue
(with some extra features, for extra credit).
Roughly, it has the basic queue
operations In and Out, Full and Empty,
plus additional functions for telling what
is the minimum or maximum element in the queue, and of searching
for a certain element to see if it is in the queue.
Overview of what to implement
You
have to implement the Queue class we discussed in class on
Thursday. Then (for extra credit)
you have to extend it with three more functions,
called Min, Max and Search (for extra extra credit, do also Sort).
These functions are doing
exactly what they say. We implemented them before,
but they worked for an array given contiguously, not
for a circular queue. The challenge is to modify them to work for
the circular queue, too. I want to see your thinking here, so I
do not give any hints on what to do.
Details
Your program should be organized as a class (IntQueue) for
the queue operations, and a testdriver (testQueue) for performing
the desired operations on the queue. The testdriver should have
the (by now very familiar) menu-driven interface, allowing the
user to add and remove items from the queue, test how big the
queue is and print the queue.
If you do the extra credit part, you should notify
me by email.
The IntQueue class should have: a constructor, a function
to add an element in the queue called In and a function to
get an element out of the queue called Out. Notice that
these names are different from those used in the book. It should
also have functions to test if the queue is empty or full, and a Print
function to be used for testing purposes. The queue has to be
implemented as a circular queue. You have to specify in the
header what queue philosophy you are implementing, among the
three we discussed in class on Thursday.
In addition to this basic structure, for extra credit
it should contain three functions
called Min, Max and Search.
The testdriver should test all
these functions on the queue.
References
Chapter 9 has the Queue Abstract data type, which you should
use as reference, but implement the queue EXACTLY as I specified
above. Your queue should contain only integers and be called
IntQueue.
To submit
Submit in Hw7 all the files: sources, Makefile, a
typescript and a data file with your test data.
See below for naming conventions.
Naming conventions and files to submit (in Hw7):
- Queue of integers: IntQueue.cpp, IntQueue.h
- Test driver: testQueue.cpp
- Makefile
- Data file: data
- typescript
Ileana Streinu