View this PageEdit this Page (locked)Attachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Fall2002 M1 - Input and visualize a set of objects and relationships

M1 - Set up the initial objects

In this project, you will input a set of objects representing individuals who are related, and a set of relationships about those individuals. You will also create a graphical representation of these objects and representations.

You will create people by sending new to Person. The relationships and information that you need to support (assume that p := Person new. q := Person new. r := Person new.) :
Note that any of these can occur in any order, e.g., you can set up parent-child relationships before you set the names for anyone.

Thinking ahead: Genealogical information systems typically make significant use of family structure records along with records corresponding individuals. It is possible to satisfy the requirements of this milestone working only with instances of the class Person as suggested by the examples above. However, you might choose to include Family objects in the structures you create as an alternate way to represent familial relationships. In this context, the notion of a family means a man and a woman plus their natural children.

You must also provide a visualization for the information you've gathered. The message p visualize must provide a visualization for p and all of the ancestors and descendants and spouses of p. There will be no more than five generations above and below (TOTAL, e.g., 2 above and 3 below) p in our tests, with no more than seven siblings in a generation. Fit your visualization within 800x600 (horiz x vert). All the non-miscellaneous information must be displayed. Provide a legend to explain your visualization.

TAs will test your code with some set of commands executed as a workspace. You may assume that we will not create trick or non-mirrored data. If p is married to q, we will also define q married to p. If p is a sibling of q, we will also define q as a sibling of p. (Be sure to prevent duplicate relationships in your own code!) We won't create odd constructs like p dying before he's born, or q being her own child.

In class, please turn-in well-documented, hardcopy source code (at least two lines of comments for each non-accessor method, in-line comments at significant portions) with your name and student number on it. In addition, before class time, turn-in your code using the Fall 2002 Turnin Information with the code 'M1'.


Implementation suggestions:

Suggested plan to incrementally build the visualize method:
  1. Enumerate the generations into a list of lists of people. (Consider using OrderedCollection for building these, which lets you add to the beginning and to the end).
  2. Assign a location for each person and store that location. (Consider Dictionary as a way to implement this step.) Remember that a person has a fixed number of ancestors at each generation going backwards, so you can have fixed locations for them relative to the person being visualized.
  3. Iterate through your list and draw the representation for each person at your chosen location.
  4. Iterate through your list and draw the lines between parents and children.
This really works incrementally – you can work on each of these stages by itself and look at what you have so far.

More suggested ways to simplify things as you are getting started:

Questions on Fall2002 P1 Milestone

Links to this Page