Comp 2673, Spring2002
Programming Project 1
Assigned Friday, March 29, 2002
Due Monday, April 29, 2002
The problem
This assignment is to write a program that will read and store information
about family relationships, and derive new information about these
relationships. The program will read from a file a list
of individual's names and birthdates and the names and birthdates of
their two (biological) parents.
The file name should be passed as a command-line argument. The information
from the file
will be stored in a data structure, and the user can then ask
for information about specific individuals.
In particular, the program will be able to display lists of an individual's parents, siblings,
half-siblings, uncles/aunts, nieces/nephews, cousins, ancestors, and
descendants.
File format
The file has the following format:
Each line contains the information for one individual, in the following
format:
FirstName LastName DOB MotherFirstName MotherLastName MotherDOB FatherFirstName FatherLastName FatherDOB
Dates of Birth (DOB) are written with the format mm/dd/yyyy.
Here's a sample of the format short example data file.
Some much longer data files that you can use for testing will be given to you later.
If any piece of information for an individual
is missing, it is replaced with a "?". A person might
show up in the file only as a parent of another individual - this person
is still stored in the internal data structure, although that person's parents
are not known.
Your program needs to be robust against errors in the input file. For this
project, this means that your program must not crash if it encounters an
error, and must recover gracefully, either by interpreting the flawed file
in some meaningful way, or by abandoning reading the file, informing the
user of the problem and leaving the internal data structure in a reasonable
state.
Data Structures
Create a class that encapsulates the data for one individual. This should
include their first and last name,
two pointers for their parents, and a vector of pointers for their children.
The objects of this class (one per person) should be stored in a
vector, and the elements should
be sorted by name for speed. You may create other classes as you find useful.
Functionality of the program
Your program should have a simple user interface that allows the user
to perform several different tasks. At least, the user must be able to
do the following:
- Search for an individual by name, selecting him/her as the current
person.
- Request a display of the current person's parents
- Request a display of the current person's children
- Request a display of the current person's siblings
- Request a display of the current person's half-siblings
- Request a display of the current person's cousins
- Request a display of the current person's aunts and uncles
- Request a display of the current person's nieces and nephews
- Request a display of the current person's ancestors
- Request a display of the current person's descendants
Submission guidelines
You may work alone, or may choose to work with a partner who is also
taking Comp2673 this quarter.
All code must be written individually and independently
by the two in your group. If you choose to work with another
person, you are responsible for dividing the work in an equitable
way, and each of you is responsible for understanding every
part of the program.
At the top of each file, put comments with your name(s), the date, course
number, and assignment number. As always, write the program with a
well organized structure, format it consistently, and document your
program by naming functions and variables in a useful way, and by writing
comments that would help someone understand how the code works so they
could modify, enhance, or debug it. Functions should perform a specific
and well-defined task that is described in comment lines above the
function header. The logical flow of your program should be simple and
easy to follow.
Turn in a hard copy
of the header files and source code at the beginning of class on the
due date. Also turn in a hard copy of a separate document which
explains your program - this
should include an explanation of the input and output of your program,
the structure of your program, including classes and functions.
You will also submit your program electronically before class on the
due date - instructions on electronic submission will be announced.