Modifier and Type | Field and Description |
---|---|
protected java.util.GregorianCalendar |
birthDate
The person's birth date.
|
protected java.lang.String |
firstName
The person's first name.
|
protected java.lang.String |
lastName
The person's first name.
|
Constructor and Description |
---|
Person(java.lang.String lastName,
java.lang.String firstName,
int birthYear,
int birthMonth,
int birthDay)
Builds a new instance
|
Modifier and Type | Method and Description |
---|---|
int |
getAge(java.util.GregorianCalendar date)
Return this person's age at a given date, in years.
|
java.lang.String |
getFirstName()
Retrun this person's first (given) name.
|
java.lang.String |
getName()
Return this person's last name.
|
boolean |
wasBorn(java.util.GregorianCalendar date)
Decides whether this person was born at a given date.
|
protected java.util.GregorianCalendar birthDate
protected java.lang.String firstName
protected java.lang.String lastName
public Person(java.lang.String lastName, java.lang.String firstName, int birthYear, int birthMonth, int birthDay)
lastName
- The person's last namefirstname
- The person's first (given) namebirthYear
- The person's birth year (e.g., 1998 for birth date 1998-7-12)birthMonth
- The person's birth month (1 for January, ..., 12 for December)birthDay
- The person's birth day in the month (e.g., 12 for birth date 1998-7-12)java.lang.IllegalArgumentException
- if the arguments do not constitute a valid birth datepublic java.lang.String getFirstName()
IPerson
getFirstName
in interface IPerson
public java.lang.String getName()
IPerson
public boolean wasBorn(java.util.GregorianCalendar date)
IPerson
public int getAge(java.util.GregorianCalendar date)
IPerson