CECS 274 Assignment 4: Creating a Queue ADT using C++, Assignments of Computer Science

Instructions for assignment 4 in cecs 274 programming and problem solving ii course. Students are required to create a queue adt using c++ and an array, including operations like enqueue, dequeue, isempty, front, length, and print.

Typology: Assignments

Pre 2010

Uploaded on 08/19/2009

koofers-user-xk7
koofers-user-xk7 🇺🇸

9 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CECS 274 Programming and Problem Solving II
Assignment 4
Due Wednesday, Ocotber 18, 2000
Purpose:
To create an ADT for a simple Queue. You must understand the logical design of queues, and
use classes, structs and arrays to complete this project.
Problem:
Modify your class ArrayList from Assignment 3, to be a C++ class called Queue that represents
a queue of information. The queue will be implemented using an array. The information stored
in the list should be a student record containing a student ID number and a letter grade.
You must include the following operations in your class Queue:
®Queue() -- Creates an empty queue.
®IsEmpty() -- Determines whether a queue is empty. Returns a Boolean value TRUE if
the list is empty, FALSE otherwise.
®Enqueue(NewItem, Success) -- Inserts NewItem at the end of the queue. Success is
set to TRUE if Enqueue is successful, FALSE otherwise.
®Dequeue(Success) -- Deletes the first item from the queue item from the queue.
Success is set to TRUE if Dequeue is successful, FALSE otherwise.
®Front(Item, Success) -- Retrieves the value of the data at the front of the queue. The
value of the data item is returned in Item. Success is set to TRUE if Front is
successful, FALSE otherwise.
®Length() -- Returns a count of the number of items stored in the queue.
®Print() -- Prints the contents of the queue, from front to back, neatly formatted.
Programming Notes:
Duplicate ID numbers are allowed in the queue.
You will be provided with a main program that tests your package.
Submission:
Turn in and demonstrate your completed C++ program during lab.
Your submission should include specification information for the modular design of this
program. You should include program documentation and specifications for each function you
will be using (including preconditions and postconditions). Please see the handout provided
with Assignment 2 on Program Documentation. Note: Spelling and grammar are important.
Dr. Tracy Bradley Maples

Partial preview of the text

Download CECS 274 Assignment 4: Creating a Queue ADT using C++ and more Assignments Computer Science in PDF only on Docsity!

CECS 274 Programming and Problem Solving II

Assignment 4

Due Wednesday, Ocotber 18, 2000

Purpose:

To create an ADT for a simple Queue. You must understand the logical design of queues, and use classes, structs and arrays to complete this project.

Problem:

Modify your class ArrayList from Assignment 3, to be a C++ class called Queue that represents a queue of information. The queue will be implemented using an array. The information stored in the list should be a student record containing a student ID number and a letter grade. You must include the following operations in your class Queue : ® Queue() -- Creates an empty queue. ® IsEmpty() -- Determines whether a queue is empty. Returns a Boolean value TRUE if the list is empty, FALSE otherwise. ® Enqueue(NewItem, Success) -- Inserts NewItem at the end of the queue. Success is set to TRUE if Enqueue is successful, FALSE otherwise. ® Dequeue(Success) -- Deletes the first item from the queue item from the queue. Success is set to TRUE if Dequeue is successful, FALSE otherwise. ® Front(Item, Success) -- Retrieves the value of the data at the front of the queue. The value of the data item is returned in Item. Success is set to TRUE if Front is successful, FALSE otherwise. ® Length() -- Returns a count of the number of items stored in the queue. ® Print() -- Prints the contents of the queue, from front to back, neatly formatted.

Programming Notes:

Duplicate ID numbers are allowed in the queue. You will be provided with a main program that tests your package.

Submission:

Turn in and demonstrate your completed C++ program during lab. Your submission should include specification information for the modular design of this program. You should include program documentation and specifications for each function you will be using (including preconditions and postconditions). Please see the handout provided with Assignment 2 on Program Documentation. Note : Spelling and grammar are important. Dr. Tracy Bradley Maples