Logic for family tree program
- by david robers
Hi All,
I am creating a family tree program in Java, or at least trying to. I have developed several classes:
Person - getters and setter for name
gender age etc
FamilyMember - extends Person getters
and setters for setting arents and
children
Family - which consists of multiple
family members and methods for adding
removing members
FamilyTree which is the main class
for setting relationships.
I have two main problems:
1) I need to set the relationships between people. Currently I am doing:
FamilyMember A, FamilyMember B
B.setMother(A);
A.setChild(B);
The example above is for setting a mother child relationship.
This seems very clunky. Its getting very long winded to implement all relationships. Any ideas on how to implement multiple relationships in a less prodcedural way?
2) I have to be able to display the family tree. How can I do this? Are there any custom classes out there to make life easier?
Thanks for your time...