Programming Assignment #3

 

CS 202: Programming Systems

Winter 2006

 

 

 

Program Statement:

We use multi-threaded lists frequently when we have one set of data with multiple search keys available (and multiple head pointers!). For example, let’s say you were working on developing a real estate application for an agency – where an agent could list houses, sell houses, keep track of all of the houses listed by their agency, display all of the houses sold, pending, and active, etc. There might be just one list of houses; but, within that list the data could be accessed by (a) price, and also by (b) status: sold, pending, active. So, we could quickly retrieve all houses within a given price range. Or, we could quickly retrieve all active houses.

 

In program #3, we still want to think about developing an object oriented design. But, as part of this design we want to create a complete data type, using operator overloading. As part of this real estate application, you will create a multi-threaded list ADT. You should have full support of the operators we are learning in class: =, +, +=,  ==, !=, the relational operators, equality operators, and the ability to input/output data. You may find that some operators don’t apply at all (and therefore shouldn’t be implemented). Don’t forget your copy constructor!

 

You may NOT perform user defined type conversion as part of your solution.

 

Definition:

When using operator overloading, remember to ask yourself the following questions:

a)      What should be the residual value (and what data type is this)?

b) Should it be a modifiable lvalue or an rvalue? Lvalues are returned by reference, most rvalues are returned by value.

      c) What are the data types of the operator’s operands?

d) Is the first operand always an object of class? If so, then it should be a member function.

e) Can the operator be used with constant operands? If the first operand can be a constant, and IF it is a member function, then it should be a constant member function.

 

Implementation Requirements:

a)      Whenever possible return a reference

b)      Your grade will be based on efficient implementation of operators and member functions; for example, minimize the need for the copy constructor to be invoked!

c)       Make sure to pick symbols to be overloaded which follows their predefined intent as much as possible

d)       Make sure to use dynamic memory for your data structures. This means you will need a constructor, destructor, copy constructor and assignment operator to start with.

e)      Support complete data hiding (all data members must be private)

f)        Separate the class definition from the implementation (separate .h and .cpp files)

g)      Use Operator Overloading

h)       Use only the <iostream.h> I/O facilities...and not <stdio.h>

i)        You may use structs this time – but only if you can prove to that your solution is still object oriented!

 

Also, test out each of the operators you overload, such as assignment, equality, and any arithmetic operators, etc. Make sure it is possible for the grader to be able to test your operators in a reasonable way.

 

 

What to Turn in:

• On the due date, email only your source code  to: karlaf@cs.pdx.edu

The subject of your email should state:

            cs202 prog3 submission <your last name>

 

• Also, on the due date turn in a hard copy of your program's source code and a hard copy of output; show that you tested all boundary conditions.

 

• Remember that 20% of each program's grade is based on a written discussion of the UNIX tools used, and major design considerations encountered when solving the problem.