daysPastInYear method

int daysPastInYear(
  1. int monthNum,
  2. int dayNum,
  3. int year
)

It returns the number of days past in the year.

Args: monthNum (int): The month number (1-12) dayNum (int): The day of the month (1-31) year (int): The year in question.

Implementation

int daysPastInYear(final int monthNum, final int dayNum, final int year) {
  var totalMonthLength = 0;
  for (var count = 1; count < monthNum; count++) {
    totalMonthLength += daysInMonth(count, year)!;
  }
  return totalMonthLength + dayNum;
}