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, 22.06.2019 00:30
These tools give presenters more freedom to move about the room and interact with their audience. laptop computer laser pointer lcd projector remote control
Answers: 2
question
Computers and Technology, 22.06.2019 11:10
Look at the far left lane in the picture. explain what the red car is doing and what it needs to do to travel safely.
Answers: 2
question
Computers and Technology, 22.06.2019 17:30
Under which key category do the page up and page down keys fall? page up and page down keys fall under the keys category.
Answers: 1
question
Computers and Technology, 23.06.2019 08:00
Match the items with their respective descriptions.
Answers: 1
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, 10.11.2020 01:00
question
English, 10.11.2020 01:00
question
Mathematics, 10.11.2020 01:00
question
Physics, 10.11.2020 01:00
question
Mathematics, 10.11.2020 01:00
question
Mathematics, 10.11.2020 01:10
Questions on the website: 13722362