312-174
Lab 10
Spring 2000
Due (PreLab, bridge): Friday, 7 Apr 2000, end of class.
Due (In-Lab/PostLab): Monday, 10 Apr 2000, end of class.
Goals:
- Use inheritance.
- Review pointers.
Note: even though this is lab 10, we are using lab 9 from the Roberge book!
Requirements.
- Complete prelab 9 and the bridge exercise from the Data Structures in C++
lab manual by Roberge. This lab creates an ordered list (ie, sorted list) based on
inheritance from an unordered list. Thus you will have to use the unordered list that you
created in Lab 4 (array implementation). You must modify this code slightly as described
in the prelab exercise and you must include it in your project.
You may work in pairs for the PreLab and bridge.
You may use your implementation of lists from lab 4. Note that these are no longer on the
web, so you can only use your implementation if you have kept a file backed up on a disk
somewhere.
As an alternative, I have put a solution to lab 4 in the software folder for
lab 10. You will have to test this solution (and fix it if you discover problems) and make
any changes called for in prelab 10. Note that this solution does not have pre/post conditions
in it and you do not have to put any in (you're just inheriting the code after all). You DO
have to put in pre/post conditions on the functions that you write for the orderedList (since this
code is your responsibility).
Turn in your completed pages 173 and 174 in class on Friday.
Place all the
files that I need to run your solution into a folder labeled with
your last name(s) and drag it into the appropriate prelab folder
in the Turn-In folder on Nova. If I cannot open your folder,
double click on your project file, and run your solution (or
at least look at it in C++ builder if you haven't completed it), you
will not get credit for handing it in.
- You must next complete in-lab exercise 2 from the lab book.
This part must be done individually.
- Finally, complete postlab exercise 1 parts A and B. This must be done
individually.
Turn in pages 177-178, and 181-182 in class Monday. Place all of the
files that I need to run your in-lab solution into a folder labeled
with your last name and drag it into the appropriate lab folder
in the Turn-In folder on Nova.
Late prelabs, bridges, and postlabs will be penalized as described in the study guide.
All results must be put into the appropriate lab folder on
the cs174jb nova account.
All prelabs must have a heading identifying the people who worked on the
project. Programs must also contain appropriate comments and headings.
Make sure that your code is commented and formatted appropriately.
See the style sheets.
Additional requirements:
- Make sure that your test plan covers both characters and integers.
- You must include pre and post conditions in every member function that
you write (both preLab and Lab). These must be as specific as possible.
- Your code must be commented and appropriately formatted. Code
in any block (ie in any set of braces) must be indented at least 3 spaces.
- Your member functions must check for any requirements (preconditions) that
are part of the ADT structure. If the requirements
are not met by the parameters, the member functions must provide a proper
response.
- Place only your last names on the folder that you turn in. Make sure
that the prelab is placed in the prelab folder on Nova and the lab is placed in the
lab folder on Nova.
- Written answers must be legible. If I can't read an answer, I will
mark it wrong. Print or type if you must.
Hints:
- Follow the lab's instructions for virtual functions. Make sure that the functions
in the derived class that you want to be virtual have the exact same prototype as the
functions in the base class.
- Read about protected variables in the lab manual. You will be changing the
private variables in the List class to protected variables so that the derived class (ie
the ordered list) can access them. See page 170 of the lab manual.
- Remember that you must allocate storage explicitly
(by using new) before you can reference a value using a pointer variable.
- Remember that a enqueue operation will require the dynamic creation of a new
QueueNode element.
- Remember to delete an element if you dequeue it or when you run clear().
You will lose points for memory leaks!
Return to Student Pages
Return to John Barr's Home Page
Last Modified: 31 March 2000
THIS PAGE MAINTAINED BY:
John Barr, Ithaca College