public class Year {

	/**
         * author: Chris Johnson
         * test for elementary Year  methods
	 * @param args single optional argument: value of year (default 1946)
	 */
	public static void main(String[] args) {
		// simple smoke tester for isLeapYear method
		Year x;
		// take the value from a command line argument if one is supplied, otherwise default is 1946
		if (args.length > 0)
			x = new Year(Integer.parseInt(args[0]));
		else x = new Year(1946);
		
		if (x.isLeapYear()) {
			System.out.println("Yes, " + x.getValue() + " is a leap year");
		}
		else {
			System.out.println("No, " + x.getValue() + " is not a leap year");
		}
	}

	private int value;
	public Year(int yval) {
		value = yval;
	}
	
	/**
	 * accessor
	 * @return stored value of Year
	 */
	public int getValue() {
		return value;
	}
	
	/**
	 * decide whether this year is a leap year by the Gregorian calendar
	 * @return true iff this year is a Gregorian leap year
	 */
	public boolean isLeapYear() {
		// TODO replace this with code to test whether value is divisible by 4 but not divisble by 100,
		// or is divisible by 400 (this is the rule for a Leap Year in the common Western
		// "Gregorian" calendar)
		return value % 4 ==0;
	}
	
}

