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, 23.06.2019 06:00
What machine listens for http requests to come in to a website’s domain? a. a router b. a browser c. a server d. a uniform resource locator
Answers: 1
question
Computers and Technology, 24.06.2019 07:30
Jason is working on a microsoft excel worksheet and he wants to create a print preview shortcut. his teacher asks him to access the customization option to create the new shortcut. which two tabs should jason select to place the print preview shortcut on the worksheet toolbar? a. new tab (custom) and new group (custom) b. new file tab (custom) and new tab (custom) c. new custom group and new command d. new custom tab and new command
Answers: 2
question
Computers and Technology, 24.06.2019 13:30
Consider jasper’s balance sheet. which shows how to calculate jasper’s net worth?
Answers: 1
question
Computers and Technology, 24.06.2019 13:50
Write a program that performs a simple n-body simulation, called "jumping leprechauns." this simulation involves n leprechauns, numberd 1 to n. it maintains a gold value g_i for each leprechaun i, which begins with each leprechaun starting out with a million dollars worth of gold, that is, g_i = 1000000 for each i = 1,. in addition, the simulation also maintains, for each leprachaun,i, a place on the horizon, which is represented as a double-precision floating point number, x_i. in each iteration of the simulation, the simulation processes the leprachauns in order. processing a leprachaun i during its iteration begins by computing a new place on the horizon for i, which is determined by the assignment:
Answers: 3
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, 27.05.2021 23:20
question
Biology, 27.05.2021 23:20
question
Mathematics, 27.05.2021 23:20
Questions on the website: 13722360