Computers and Technology

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

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 23:30, brainbean
Select all that apply. which of the following are proofreading options included in microsoft word? spell check find replace grammar check formatting check
Answers: 1
image
Computers and Technology, 23.06.2019 11:30, magicalpenguin48
In cell h5 enter a formula that will calculate the percentage of attendees that went to the altamonte springs job fair in 2018.
Answers: 1
image
Computers and Technology, 23.06.2019 17:30, Annlee23
When making changes to optimize part of a processor, it is often the case that speeding up one type of instruction comes at the cost of slowing down something else. for example, if we put in a complicated fast floating-point unit, that takes space, and something might have to be moved farther away from the middle to accommodate it, adding an extra cycle in delay to reach that unit. the basic amdahl's law equation does not take into account this trade-off. a. if the new fast floating-point unit speeds up floating-point operations by, on average, 2ă—, and floating-point operations take 20% of the original program's execution time, what is the overall speedup (ignoring the penalty to any other instructions)? b. now assume that speeding up the floating-point unit slowed down data cache accesses, resulting in a 1.5ă— slowdown (or 2/3 speedup). data cache accesses consume 10% of the execution time. what is the overall speedup now? c. after implementing the new floating-point operations, what percentage of execution time is spent on floating-point operations? what percentage is spent on data cache accesses?
Answers: 2
image
Computers and Technology, 24.06.2019 03:30, live4dramaoy0yf9
Explain the importance of html in web page designing in 20 sentences..
Answers: 1
Do you know the correct 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, 26.10.2020 03:50
Konu
Mathematics, 26.10.2020 03:50
Konu
Mathematics, 26.10.2020 03:50