A year with 366 days is called a leap year. A year is a leap year if it is divis
ID: 3624481 • Letter: A
Question
A year with 366 days is called a leap year. A year is a leap year if it is divisible by 4 (for example, 1980). However, since the introduction of the Gregorian calendar on October 15, 1582, a year is not a leap year if it is divisible by 100 (for example, 1900); however, it is a leap year if it is divisible by 400 (for example, 2000). Write a program that asks the user for a year and computes whether that year is a leap year. Implement a class Year with a predicate method boolean isLeapYear().You need to supply the following class in your solution:
Year
Use the following class as your tester class:
public class YearTester
{
public static void main(String[] args)
{
Year y = new Year(1980);
System.out.println(y.isLeapYear());
System.out.println("Expected: true");
y = new Year(1900);
System.out.println(y.isLeapYear());
System.out.println("Expected: false");
y = new Year(2000);
System.out.println(y.isLeapYear());
System.out.println("Expected: true");
y = new Year(1500);
System.out.println(y.isLeapYear());
System.out.println("Expected: true");
y = new Year(1501);
System.out.println(y.isLeapYear());
System.out.println("Expected: false");
}
}