diff --git a/src/main/java/APCalendar.java b/src/main/java/APCalendar.java index 46a3aa8..6c17f9b 100644 --- a/src/main/java/APCalendar.java +++ b/src/main/java/APCalendar.java @@ -13,7 +13,15 @@ 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 y=year1;y<=year2;y++) + { + if(isLeapYear(y0) + { + count++; + } + } + return count; } /** Returns the value representing the day of the week for the first day of year, @@ -52,5 +60,10 @@ 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 startDay=firstDayofYear(year); + int nthDay=dayofYear(month, day, year); + int returnDay= (startDay+nthDay-1)%7; + return returnDay; + } }