Question: Write a Java Class that computes and prints all the leap years between a starting and ending year. A year is a leap year if

Write a Java Class that computes and prints all the leap years between a starting and ending year. A year is a leap year if it meets one of the two conditions below:

1. A year is a leap year if it is divisible by 4 and not divisible by 100 (For example, 1980).

2.A year is a leap year if it is divisible by 400 (for example, 2000)

Write a program that does the following:

1. Prompts the user for the starting year

2. Prompts the user for the ending year

3. Prints all the leap years between the start year and the ending year separated by a space

4. Ten years or less will be printed on each separate line of output

5. At the end, the program will print the total number of leap years between the start and end years entered by the user

Ask the user for the starting year and ending year on separate lines

Use a loop to generate the years between the start year and the end year

Include the leap years in the output in the following format:

1. Years separated by a space

2. No more than 10 years printed on any one line

At the end, the program will print the correct total number of leap years between the start and end years entered by the user

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 Databases Questions!