In one of my constructors i have :
public Author(String firstName, String lastName, String middleName, int yearBorn,
int monthBorn, int dayBorn, int yearDied, int monthDied, int dayDied,
String pseudonymFirstName, String pseudonymLastName, String pseudonymMiddleName ){
name = new Name(firstName,lastName,middleName);
born = new Date(yearBorn, monthBorn, dayBorn);
died = new Date(yearDied, monthDied, dayDied);
if((pseudonymFirstName == null) && (pseudonymLastName == null) && (pseudonymMiddleName == null)){
pseudonym = null;
}else{
pseudonym = new Name(pseudonymFirstName,pseudonymLastName,pseudonymMiddleName);
}
}
this constructor calls methods in other classes to store values for the Author
class.
now i want to make a method that subtracts the value of yearBorn
from the current year
giving me the age of the Author
so far my methond looks like:
public int getAgeYearsOfAuthor(){
return CURRENT_YEAR - (WHAT DO I PUT HERE?????);
}
how do i extract the yearBorn
value (which is an int) form: born = new Date(yearBorn, monthBorn, dayBorn);
in the constructor??