# Question & Answer: For this exercise, you are going to take your function leap year program that you wrote last week and put the logic of calculating…..

For this exercise, you are going to take your function leap year program that you wrote last week and put the logic of calculating whether it is a leap year into a function. The function prototype should be int isteapYear (int year) It should return 0 if t is not a leap year and 1 if t is a leap year. Your leap year function must not print anything. You should call this function from your main function, which is where you print the result. \$./leapYear2 Enter a year after 1582: 12 12 is before 1582. \$./leapYear2 Enter a year after 1582: 2000 2008 is a leap year. \$./leapYear2 Enter a year after 1582: 2004 2004 is a leap year.

The code is given below with the given requirement and also with sample output screenshots so please thumbs up and if you have any doubts please do comment i will get back to you.

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: For this exercise, you are going to take your function leap year program that you wrote last week and put the logic of calculating…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

code:

/*

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package javaapplication1;

import java.util.Scanner;

/**

*

* @author miracle

*/

public class IsLeapYear

{

public static void main(String[] args) //main function

{

Scanner keyboard = new Scanner(System.in);

System.out.print(“Please enter a year after 1582: “);

final int Year = keyboard.nextInt();

if (Year < 1582) //calculation part for leapyear

{

System.out.println(Year + ” is before 1582″);

}

else if ((Year % 4 == 0 && Year % 100 > 0) || (Year % 400 == 0))

{

System.out.println(Year + ” is a leap year.”);

}

else{

System.out.println(Year + ” is NOT a leap year.”);

}

}

}

Sample Output 1 :

Sample Output 2:

Sample output 3: