Hi guys!
I have to implement a family tree in Java. I have an input file with family relations that sounds like this :
John child Ben (-> John is the child of Ben ; Ben is the parent of John)
Ben (-> if the line contains only one string that means the person is the Root )
Tim brother Mary (-> Tim is the brother of Mary; Mary has Tim as a brother)
Sarah cousin Marshall (-> Sarah is the cousin of Marshall ; Marshall is a cousin of Sarah )
Marshall brother Sophie (-> Marshall is a brother of Sophie ; Sophie is a "sister " of Marshall )
Mary parent Sarah (->Mary is the parent of Sarah; Sarah is a child of Mary)
Sophie child Tim (->Sophie is a child of Tim;Tim is Sarah's parent)
John brother Mary (->John is a brother of Mary;Mary is a "sister" of John)
Note that I have an abstract class called Person with details of name, array of children,array of uncles,array of cousins and so on.
The fact is that there is only one ROOT; anybody has only one parent; the SEX doesn't matter.
I have to implement the following classes : Brother;Cousin;Uncle;Nephew;Parent;Child that extend the abstract class Person
A child is also a PERSON;
A parent can be someone's CHILD;
A brother is also a CHILD;
An uncle is someone's BROTHER;
A nephew is also a CHILD;
A cousing is also a NEPHEW;
Please give me some ideas.I would appreciate very much!