You are on page 1of 1

package com.mycompany.

activity2;
import java.util.Scanner;
public class Activity2 {
Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
Activity2 act = new Activity2();
Scanner sc = new Scanner(System.in);
boolean done=true;
while(done){
act.isLeapYear();
System.out.println("");
System.out.println("Would you like to continue, Y/N?");
String ans= sc.nextLine();

done = ans.equals("y")||ans.equals("Y");
if(ans.equals("N")||ans.equals("n")){
done=false;
}
System.out.println("");
}
System.out.println("Thank you!");
}

public void isLeapYear(){


System.out.print("Enter Year: ");
int year = sc.nextInt();

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.");
}
}
}

You might also like