Day 2: Leap Years


Exercise

Write a Java program to determine if a given year is a leap year.

Introduction

A year is a leap year if it conforms to either of the following conditions:

Algorithm

  1. Implement the core functionality using a text-based interface for I/O.
  2. Build a GUI to wrap your implementation.

Resources

Hints

Use the modulo (%) operator to determine if a number is evenly divisible by another value. For example:

12 % 3 42 % 10

The first line is equal to 0 since 12 is evenly divisible by 3. The second line is equal to 2 because the remainder of 42 / 10 is 2.


Return Home