Skip to content

Commit

Permalink
Update APCalendar.java
Browse files Browse the repository at this point in the history
  • Loading branch information
breadsticker1 authored Apr 30, 2024
1 parent bb87c50 commit b525de6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/APCalendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ private static boolean isLeapYear(int year)
public static int numberOfLeapYears(int year1, int year2)
{
/* to be implemented in part (a) */

int count = 0;
for(int i = year1; i <= year2; i++)
if(isLeapYear(i))
count++;
return count;

}

/** Returns the value representing the day of the week for the first day of year,
Expand Down Expand Up @@ -52,5 +57,9 @@ private static int dayOfYear(int month, int day, int year)
public static int dayOfWeek(int month, int day, int year)
{
/* to be implemented in part (b) */
int pooD = firstDayOfYear(year);
int pooN = dayOfYear(month, day, year);
int result = (pooD + pooN - 1)%7;
return result;
}
}

0 comments on commit b525de6

Please sign in to comment.