Question: Write the following Java function which checks to see if any given year is a leap year: User must first enter the year to be
Write the following Java function which checks to see if any given year is a leap year:
- User must first enter the year to be checked - call this variable yr.
- Write an if statement that checks to see if the year (yr) is a multiple of 4 and is not a multiple of 100 or if it is a multiple of 400 (for example, leap years that are multiples of 4 and not multiples of 100 or multiples of 400 are 1600, 1924, 1976 2000, 2016, etc. Years that are divisible by 4 but are not leap years because they are multiples of 100 include 1700, 1800, 1900, 2100, 2200, etc)
- If yes print "The year is a leap year!" and if not print "Nope it's not a leap year!"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
