/** A class that determines whether or not a year in the Gregorian calendar is a leap year. */ public class GregorianYear { /** Contructs a year equal to zero. */ public GregorianYear() { year = 0; } /** Sets the year. @param year the year to set */ public void setYear(int year2) { year = year2; } /** Gets the year. @return year the year to get */ public int getYear() { return year; } /** Returns true if the year is a leap year and false otherwise. @return true if the year is a leap year and false otherwise */ public boolean isLeapYear() { if (year % 4 == 0) // Is the year divisible by 4? { if (year % 100 != 0) // Is the year divisible by 4 but not 100? { return true; } else if (year % 400 == 0) // Is the year divisible by 4 and 100 and 400? { return true; } else // The year is divisible by 4 and 100 but not 400. { return false; } } else // The year is not divisible by 4. { return false; } } private int year; }