Project 2 - OOD and Recursion
Due - Tuesday, March 29, 2005
The goal of this project is to give you an opportunity to practice
using object-oriented design and recursion. Your program should
be implemented in C++ and should use classes where appropriate.
Points will be deducted for poor design -- for example if all of
your data members are made public.
In this project, you will write a job posting database. Your
database should maintain a listing of job posting records and should
allow the following functions:
Add a new posting -- The user must be able to add a new job
posting to the database.
Remove a posting -- The user must be able to remove an existing
posting from the database.
Modify a posting -- The user must be able to modify one or more
fields of an existing posting in the database.
Sort by job type -- The user must be able to view all jobs
sorted by job type.
Sort by salary -- The user must be able to view all jobs sorted
by salary.
Sort by employer -- The user must be able to view all jobs
sorted by name of the employer.
Query number of postings by a given employer -- The user must
be able to view the total number of jobs posted by a given employer.
Query number of postings for a given job type -- The user must
be able to view the total number of jobs posted for a given job type.
Implementation Requirements
Your program must adhere to the following guidelines unless we
have explicitly discussed an alternative.
You must implement a JobPosting base class which can store and
provide access to information about a generic job posting. This
information should include (at minimum), the employer, the
salary, and a job description. This class must be an abstract
class.
You must also implement three derived classes, each to represent a
different type of job posting: Clerical, Technical, and Managerial.
Each subclass must store and provide access to position-specific
information. In particular, the Managerial class must store
information about the amount of travel expected, the Technical
class should store information about technical skills required,
and the Clerical class should store information about clerical
skills required. Minimally, you must store this set of
information. You may choose to expand each of these classes to
provide additional information as well. Each subclass must also
implement its own print function that should print all of the
relevant information for a posting of that particular type.
Obviously, print should be a virtual function.
The job posting records must be dynamically allocated (on the
heap). In order to keep them sorted in the three required ways
(by job type, by salary, and by employer), you must keep three
arrays of pointers to JobPosting objects. Each array will sort
the data in a different way. As you insert new objects, you must
insert pointers to those object in the appropriate place in each
of the three arrays. As you remove objects, you must remove the
pointers appropriately.
Your function(s) to implement the query number of postings by employer and job type
operations must be implemented recursively. Your
function(s) to query number of postings by employer must
recursively traverse the array of links sorted by employer and
count the number of items that match the search criteria. You can
stop traversing the list when you have found all postings for the
given employer. The query number of postings by job type
operation must
work the same way.
As you add new postings, make sure to create the appropriate type
of subclass (Clerical, Technical, or Managerial). The design of
the user interface is up to you. However, think carefully about
how the user will specify which job posting she wishes to remove
if she chooses the remove option and how she will specify the
posting she wishes to change if she selects the modify option. Finally, think carefully about
how you will determine the type of a particular job. For example,
you might consider using casting.
The remainder of the program design is up to you. For example,
you might choose to implement a DataBase class, a User Interface
class, and a Test class. If your program is poorly designed, for
example if it only includes the JobPosting class and the three
position-specific subclasses, points will be deducted.
Extra Credit Opportunity
For extra credit, provide an option to save data to a file and read
data in from a file when the program launches. In addition to
increasing your grade, this will greatly simplify the testing of
your program.
Part 1 - Due Tuesday, March 8, 2005
For part 1, you must submit the design of your program and
algorithms for each piece of your design. This should include a
short description of each class you plan to implement, the members
(variables and functions) of each class, and complete algorithims
for each member function (including main). Make sure to submit
recursive algorithms for the query number of postings by employer
and job type operations.
Part 2 - Due Tuesday, March 29, 2005
- Complete and submit your working code.
- Make sure that each function is well documented. Your documentation should specify the type and function of the input paramaters and ouput.
- Run your program on a variety of inputs ensuring that all error conditions are handled correctly.
Reminder: No part of your code may be copied from any other
source. All code submitted must be original code written by you.
Sami Rollins