Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 1 The calendar we are using now is the Gregorian calendar from 1582. A year is a leap year if: A year is divisible

Problem 1

The calendar we are using now is the Gregorian calendar from 1582. A year is a leap year if:

  • A year is divisible by 4, but not by 100, or
  • A year is divisible by 400
  • Requirements:

  • Use either while loop or for loop to display all the leap years from year 1582 to the year from the user input.
  • Create a flowchart of your program design.
  • Use pseudo code to describe each step in your code.
  • Check the input that should be equal or greater than 1582, if not, prompt for asking a correct year until a correct input.
  • You should use Scanner to take the input year.
  • Use the year 1900, 2000, and 2019as 3 different years to test your code. Take screenshots of these 3 runs.
  • The format of the result will be one leap year in a line such as (Note: this is just an example, you need to show all the years of leap year up to your input)
  • Example:

  • Leap years from year 1582 to 1600:

    1584

    1588

    1592

    1596

    1600

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions