subject

A year with 366 days is called a leap year. Leap years are necessary to keep the calendar synchronized with the sun because the earth revolves around the sun once every 365.25 days. Actually, the figure is not entirely precise, and for all dates after 1582 the Gregorian correction applies. Usually years that are divisible by 4 are leap years, for example 1996. However, years that are divisible by 100 (for example, 1900) are not leap years, but years that are divisible by 400 are leap years (for example, 2000). Write a program that asks the user for a year and computes whether the year is a leap year. Provide a class Year with a method isLeapYear. Use a single if statement and Boolean operators. I have two java files to work from below: Year. java and LeapYearTester. java. The LeapYearTester. java is not supposed to be altered. Any help on the problem would be appreciated. Thank you.
Year. java
public class Year{
// declare your instance variables here
// write your constructor here
public Year(int y){
// your code here
}
public boolean isLeapYear(){
// your code here
}
}
LeapYearTester. java
import java. util. Scanner;
public class LeapYearTester{
public static void main(String[] args){
Scanner input = new Scanner(System. in);
System. out. println("Please enter a year");
int year_input = input. nextInt();
// now make a Year object
Year theYear = new Year(year_input);
// now check to see if it's a leap year
if (theYear. isLeapYear())
System. out. println("That's a leap year!");
else
System. out. println("That's not a leap year!");
}
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:30
Apower user needs you to install a second type of operating system on his computer to increase efficiency while running some specialized software programs. which installation technique should you use?
Answers: 3
question
Computers and Technology, 21.06.2019 22:50
Before you enter an intersection on a green light make sure
Answers: 2
question
Computers and Technology, 23.06.2019 09:10
Effective character encoding requires standardized code. compatible browsers. common languages. identical operating systems.
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Kenny works with an it company. his company is about to launch new software in the market. he has to ensure that this new software is functional and meets all of the quality standards set up at the planning stage. which job profile is kenny likely to have? kenny is likely to have the job profile of a blank .
Answers: 2
You know the right answer?
A year with 366 days is called a leap year. Leap years are necessary to keep the calendar synchroniz...
Questions
question
Mathematics, 13.04.2021 17:00
question
Mathematics, 13.04.2021 17:00
question
Mathematics, 13.04.2021 17:00
question
Mathematics, 13.04.2021 17:00
question
Mathematics, 13.04.2021 17:00
question
Mathematics, 13.04.2021 17:00
question
Chemistry, 13.04.2021 17:00
question
Mathematics, 13.04.2021 17:00