Anne
Dawson: CSCI201A_LAB2_FA04.htm
Last
updated: Tuesday 14th September 2004, 8:14 PT
This
document is subject to change without notice.
Please
report any errors or omissions in this document:
adawson@coquitlamcollege.com
Special instructions:
For this assignment you may work in teams of 2, or alone.
This lab is due at the end of the lab session.
CSCI201A –
Data and Program Organization (Data Structures)
Fall 2004
Lab Assignment 2
Purpose: Implement a Queue using an array.
Program points will be based on the following marking scheme:
|
Category |
Points |
Description |
|
Comments |
10 |
Source code should be commented. |
|
Output |
10 |
Prompts and results should be user-friendly. |
|
Queue ADT |
30 |
Implemented correctly in separate file. |
|
Correctness |
30 |
The program should do what is required. |
|
Style |
10 |
The source code should be indented properly, use meaningful variable names, use good programming practices, etc. See the book, website and lectures for examples. |
|
Test |
10 |
Comments in the code explain how the code was tested. |
Specification : You may have noticed that lately the price of gas has jumped by about 10 cents. Often when there is a predicted increase in the price of gas, car drivers will fill up their tanks at the nearest gas station offering the lowest price. Often the pumps at these stations run out of gas. Assume the situation whereby a gas station is offering cheap gas, and now has only one pump in operation. A queue forms. Customers are served on a first come first served basis. Write a program which simulates this situation. The program must handle the case that the next customer in line must wait until the customer currently using the pump has finished and moved off before allowing the next customer access to the pump. There is also a limit to the allowable length of the queue. The gas station employees permit a maximum queue length of 15 vehicles, otherwise the queue will extend onto the highway, which would cause an obstruction. Enhance the program in any way you wish.
Implement class Queue in C++ or Java. It will provide enqueue() and dequeue()operations. Other functionality will adhere to the normal queue model as discussed in this week’s lecture, i.e. FIFO access. Write a driver to test your class.
Source Code Format : As stated above, the source code should follow good programming style. In addition, each file should start with a comment block that contains the following information:
/*
Name:
[Team:]
Program:
Description:
*/
Name is yours. Program is the program name. Description can be a short, 1-2 sentence description.
Assignment Presentations
: In the next class, two
individuals (or teams) will be selected at random to present their results to
the group.