===============================================
Contents for Main.java
===============================================
import java.util.*;

public class Main
{
   public static void main(String[] args)
   {
	   
	   System.out.print("Please enter the date (eg. \"2013 12 31\"): ");
	   
	   Scanner scannerObj = new Scanner(System.in);
	   int y, m, d;
	   y=scannerObj.nextInt();
	   m=scannerObj.nextInt();
	   d=scannerObj.nextInt();
	   
	   if (Day.valid(y, m, d)==false) //check whether the input is valid
	   {
		   System.out.println("Wrong input.  Program stopped.");
	   }
	   else
	   {
		   Day dayObj = new Day(y,m,d); //create a Day object for the input
		   
		   System.out.println("\nYou have entered " + dayObj.toString());
		   
		   if (Day.isLeapYear(y))
			   System.out.println("It is a Leap Year.");
		   else
			   System.out.println("It is NOT a Leap Year.");
	   }
	   scannerObj.close();
   }
}

===============================================
Contents for Day.java
===============================================

public class Day {
	
	private int year;
	private int month;
	private int day;
	
	//Constructor
	public Day(int y, int m, int d) {
		this.year=y;
		this.month=m;
		this.day=d;		
	}
	
	// Return a string for the day like dd MMM yyyy
	public String toString() {
		
		final String[] MonthNames = {
				"Jan", "Feb", "Mar", "Apr",
				"May", "Jun", "Jul", "Aug",
				"Sep", "Oct", "Nov", "Dec"};
		
		return day+" "+ MonthNames[month-1] + " "+ year;
	}

	// check if a given year is a leap year
	static public boolean isLeapYear(int y)
	{
		if (y%400==0)
			return true;
		else if (y%100==0)
			return false;
		else if (y%4==0)
			return true;
		else
			return false;
	}
	
	// check if y,m,d valid
	static public boolean valid(int y, int m, int d)
	{
		if (m<1 || m>12 || d<1) return false;
		switch(m){
			case 1: case 3: case 5: case 7:
			case 8: case 10: case 12:
					 return d<=31; 
			case 4: case 6: case 9: case 11:
					 return d<=30; 
			case 2:
					 if (isLeapYear(y))
						 return d<=29; 
					 else
						 return d<=28; 
		}
		return false;
	}
}
