Today in class we designed and implemented a program:

import java.util.Scanner;
  
class LeapYear {
  public static void main(String[] args) {
    Scanner a; 
    a = new Scanner( System.in ); 
    System.out.print("Type year: "); 
    int year = a.nextInt(); 
    // System.out.println( year );
    if ( year <= 1582 ) { 
      if ( year % 4 == 0) {
        System.out.println("Leap year.");  
      } else { // year <= 1582 and not a multiple of 4
        System.out.println("Not a leap year.");  
      }
    } else { // year > 1582 
      if ( year % 4 == 0 ) {
        if ( year % 100 == 0) {
          if ( year % 400 == 0 ) { // year > 1582 and multiple of 4, 100 and 400 
            System.out.println( "Leap year." );              
          } else { // yea after 1582 multiple of 4 and 100 but not multiple of 400 
            System.out.println( "Not a leap year." ); 
          }
        } else { // no exception here multiple of 4 not multiple of 100 
          System.out.println("Leap year.");           
        }
      } else { // year after 1582 and not a multiple of 4
        System.out.println("Not a leap year."); 
      }
    }
  }
}

Here's how it works in DrJava:

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> run LeapYear
Type year:  [DrJava Input Box]
Leap year.
> run LeapYear
Type year:  [DrJava Input Box]
Not a leap year.
> run LeapYear
Type year:  [DrJava Input Box]
Leap year.
> run LeapYear
Type year:  [DrJava Input Box]
Not a leap year.
> run LeapYear
Type year:  [DrJava Input Box]
Leap year.
>

The design is shown in this picture:

http://www.cs.indiana.edu/classes/c212-dgerman/sum2014/leap.jpg

Then we reviewed the lab assignment so we can sart working on it right away.

--