/leapYear-kata

Kata to check if a year is leap

Primary LanguageJava

Leap Year

Implement a method that checks if a year is a leap year.

Rules:

  • A year is not a leap year if it is not divisible by 4.
  • A year is a leap year if it is divisible by 4.
  • A year is a leap year if it is divisible by 400.
  • A year is not a leap year if it is divisible by 100 but not by 400.

Examples:

  • 1997 is not a leap year (not divisible by 4)
  • 1996 is a leap year (divisible by 4)
  • 1600 is a leap year (divisible by 400)
  • 1800 is not a leap year (divisible by 4, divisible by 100, NOT divisible by 400)

The method should return 'true' if a year is a leap year, and 'false' if it is not.