Class Person

java.lang.Object
  extended byPerson

public class Person
extends Object

This class is a simple record for a person consisting of the person's name, date of birth, and date of death. There must be a date of birth, but there may be no date of death (indicating that the person is still alive).


Constructor Summary
Person(Person original)
          This is the copy constructor for the Person class.
Person(String initialName, DateClass birthDate, DateClass deathDate)
          This constructor receives the person's name, birthdate and date of death.
 
Method Summary
 boolean equals(Person otherPerson)
          This method checks to see if two Person objects contain the same data.
 DateClass getBirthDate()
           
 DateClass getDeathDate()
           
 String getName()
          These are accessor methods for the name, birthdate and date of death.
 void set(String newName, DateClass birthDate, DateClass deathDate)
          This mutator method sets the name, birthdate, and date of death.
 void setBirthDate(DateClass newDate)
          This mutator method sets the birtdate.
 void setBirthYear(int newYear)
          This mutator method sets the birth year.
 void setDeathDate(DateClass newDate)
          This mutator method sets the death date.
 void setDeathYear(int newYear)
          This mutator method sets the date of death.
 void setName(String newName)
          This mutator method sets the name.
 String toString()
          This method returns a string containing the person's name followed by their dates of birth & death.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Person

public Person(String initialName,
              DateClass birthDate,
              DateClass deathDate)
This constructor receives the person's name, birthdate and date of death.


Person

public Person(Person original)
This is the copy constructor for the Person class.

Method Detail

set

public void set(String newName,
                DateClass birthDate,
                DateClass deathDate)
This mutator method sets the name, birthdate, and date of death. precondition: the birthDate is a valid date


toString

public String toString()
This method returns a string containing the person's name followed by their dates of birth & death.


equals

public boolean equals(Person otherPerson)
This method checks to see if two Person objects contain the same data.

Returns:
Returns true if the two Person objects contain the same data.

setBirthDate

public void setBirthDate(DateClass newDate)
This mutator method sets the birtdate.


setDeathDate

public void setDeathDate(DateClass newDate)
This mutator method sets the death date.


setName

public void setName(String newName)
This mutator method sets the name.


setBirthYear

public void setBirthYear(int newYear)
This mutator method sets the birth year.


setDeathYear

public void setDeathYear(int newYear)
This mutator method sets the date of death.


getName

public String getName()
These are accessor methods for the name, birthdate and date of death.


getBirthDate

public DateClass getBirthDate()

getDeathDate

public DateClass getDeathDate()