CS 112
Hw 9
Due Wednesday April 17, by midnight
List implementation of Queues and Applications
Implement a Queue abstract data type using a linked list (instead
of an array). Then finish and recompile the bank simulator
(Hw 7) using this new queue. Part of this homework was done in Hw
7. Here are all the steps.
- Copy the Queue.h, Queue.cpp, makefile and test
driver from your Hw7.
- Modify what is necessary: the private part in the header file,
the implementation file, and maybe the test driver
(no need to test the queue becoming full!).
- Your queue should now use a list instead of an array,
so make sure you include the appropriate List class (from previous
homework) in your compilation (careful with the Makefile!).
- Then, after testing the queue and making sure it works
correctly (e.g. by using the same testdriver you had for Hw7),
copy your Bank class files and work on finishing it. In
particular, you will have to recompile everything to make it work
using the new queue.
- Along the way, you should reorganize the Bank class to make
it as "object oriented" as possible. In particular, combine
related information into struct's (e.g. all the statistics
collected on a simulation), leave only the relevant functions in
the public part of the class (i.e. what a potential user of the
Bank class needs to see, and no more than that), and reorganize
the private variables and the parameters being passed on to the
functions to reflect the "state of the bank" (e.g. tellers array
and the number of tellers are definitely a feature of the bank).
The purpose of this homework is to illustrate code reuse and
the advantages of an object-oriented design of a program, whereas changing
the implementation of a class should not affect the implementation of the
programs which used objects/methods from that class.
Testing
I will post here (by the end of the day) the data you should use for testing
the simulator and the format I expect for the input and output of
the testdriver.
To submit
Submit in Hw9 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 Hw9):
- List of customers: List.cpp, List.h
- Queue of customers: Queue.cpp, Queue.h
- Bank: Bank.h and Bank.cpp
- Test driver: testBank.cpp
- Makefile
- Data file: data
- typescript
Ileana Streinu