//package persistence; import java.util.*; public class Member extends Person { private Person spouse; private Set children; public Member(String firstName, String lastName, Date dob) { super(firstName, lastName, dob); children = new HashSet(); } public Member() { this(null, null, null); } public Person getSpouse() { return spouse; } public void setSpouse(Person spouse) { this.spouse = spouse; } public void addChild(Person child) { children.add(child); } public void removeChild(Person child) { children.remove(child); } public boolean containsChild(Person child) { return children.contains(child); } public Iterator iterator() { return children.iterator(); } public String toString() { String result = super.toString(); result = result + "\n spouse: "; result = result + spouse.getFirstName() + "\n children:"; for(Person p: children) { result = result + "\n " + p.getFirstName(); } return result; } }