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):
1. Years before 1752 are never leap years.
2. Years from 1752 onwards that are not divisible by 4 are never leap years either.
3. Years from 1752 onwards that are divisible by 4 are leap years unless they are also divisible by 100(because centuries are usually not leap years) unless the century is also divisible by 400(because that is the exception).
NOTE: The United States adopted the Gregorian calendar in 1752, so the first rule could be different in other countries, but we won't worry about that here. Again, you may need to re-organize 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!