I need to calculate the age of a person using the following: birthYear, curYear, birthMonth and curMonth.
my code is the following but it doesn't resolve in junit
public int getApproxAge2(int birthYear, int curYear, int birthMonth, int curMonth)
{
if (curMonth >= birthMonth)
{
return curYear - birthYear;
}
else
{
return curYear - (birthYear-1);
}
}