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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 17:30, Artemis3821
Scientists have changed the model of the atom as they have gathered new evidence. one of the atomic models is shown below. what experimental evidence led to the development of this atomic model from the one before it? a few of the positive particles aimed at a gold foil seemed to bounce back. the colors of light emitted from heated atoms had very specific energies. experiments with water vapor showed that elements combine in specific proportions. cathode rays were bent in the same way whenever a magnet was brought near them.
Answers: 2
image
Computers and Technology, 24.06.2019 02:10, sIatt
Consider the usual algorithm to convert an infix expression to a postfix expression. suppose that you have read 10 input characters during a conversion and that the stack now contains these symbols: (5 points) | | | + | | ( | bottom |_*_| now, suppose that you read and process the 11th symbol of the input. draw the stack for the case where the 11th symbol is
Answers: 2
image
Computers and Technology, 24.06.2019 10:30, brandon1748
You're programming an infinite loop. what must you include in your code to prevent crashes? in roblox
Answers: 2
image
Computers and Technology, 24.06.2019 16:00, dareaalcaam111
What is a dashed line showing where a worksheet will be divided between pages when it prints? a freeze pane a split box a page break a print title
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 in other subjects:

Konu
Mathematics, 25.02.2021 23:10
Konu
Spanish, 25.02.2021 23:10