Question: Make a class named LeapYear that has a main method that prompts the user for a year and then determines if it is or is
Make a class named LeapYear that has a main method that prompts the user for a year and then determines if it is or is not a leap year.
The rules are as follows though you might need to reorganize this logic to make it either clearer or more efficient:
Years before are never leap years.
Years from onwards that are not divisible by are never leap years either.
Years from onwards that are divisible by are leap years unless they are also divisible by because centuries are usually not leap years unless the century is also divisible by because that is the exception
NOTE: The United States adopted the Gregorian calendar in so the first rule could be different in other countries, but we won't worry about that here. Again, you may need to reorganize the above "logic" into an "equivalent" form that can be more easily programmed if you do it well, your code won't be very many lines
DO NOT use AND or OR operators to combine Boolean expressions. Use only properly NESTED IF ELSE structures with one Boolean operator each to make your logic work.
A scoring goal it to make sure you can nest properly and avoid unreachable code or dangling statements.
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
