Here's some background information on our Gregorian calendar. Although the Gregorian calendar was created in 1582, The United States did not adopt it until 1752. Therefore, the Gregorian calendar formula for calculating leap years only applies to years 1752 and later in the United States. The Gregorian calendar provided an improved formula for calculating which years are Leap Years. The criteria for a determining whether a year is a Leap Year is: Leap Year Definition: • The year is evenly divisible by 4; • If the year can be evenly divided by 100, it is NOT a leap year, unless; • The year is also evenly divisible by 400. Then it is a leap year. Your assignment is to create a Python program that in general uses a function to determine whether a year is a leap year and another function for obtaining year input values from the user. More specifically your program should: 1. Contain a function that determines whether a year passed to it is: a. A valid year for the Gregorian calendar usage in the United States, i.e. Year >=1752. b. If it is a valid year, apply the Leap Year definition to it to determine whether it is a leap year. c. Return to the calling function whether the year was invalid, a leap year, or not a leap year. d. This function should not print anything. 2. Contain a function to obtain a non-negative year (a number greater than or equal to zero). a. The function should provide the user with a way to abort the entry process. b. Handle invalid inputs. c. Return a valid number or whatever you are using to signify that the user wishes to exit the program. I suggest using a value of 0. 3. The main program should do the following. a. Create a list of years containing 1500, 1900, 2000, 2001, 2002, 2003, and 2004. b. Call your function to determine whether the years in the list are leap years and output the year and whether or not it is a leap year. If the leap year calculation was not valid for the year it should print a message to that effect. c. Have a loop to allow the user to determine whether additional years are leap years. After each year is entered, the program should indicate whether the year is a leap year. Of course, it should include a way for the user to exit the loop and end the program. d. Since the output for items 3.b and 3.c are the same, you could create an additional function to be called to print the results out for each year. Using an additional function for printing the results is an option and is not a requirement.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter2: Problem Solving Using C++using
Section2.1: Introduction To C++
Problem 10E: (Practice) You’re given the job of preparing a complete meal for five people next weekend. Determine...
icon
Related questions
Question
100%

Here's some background information on our Gregorian calendar. Although the Gregorian
calendar was created in 1582, The United States did not adopt it until 1752. Therefore, the
Gregorian calendar formula for calculating leap years only applies to years 1752 and later in the
United States. The Gregorian calendar provided an improved formula for calculating which
years are Leap Years. The criteria for a determining whether a year is a Leap Year is:
Leap Year Definition:
• The year is evenly divisible by 4;

• If the year can be evenly divided by 100, it is NOT a leap year, unless;
• The year is also evenly divisible by 400. Then it is a leap year.
Your assignment is to create a Python program that in general uses a function to determine
whether a year is a leap year and another function for obtaining year input values from the user.
More specifically your program should:
1. Contain a function that determines whether a year passed to it is:
a. A valid year for the Gregorian calendar usage in the United States, i.e. Year
>=1752.
b. If it is a valid year, apply the Leap Year definition to it to determine whether it is
a leap year.
c. Return to the calling function whether the year was invalid, a leap year, or not a
leap year.
d. This function should not print anything.
2. Contain a function to obtain a non-negative year (a number greater than or equal to zero).
a. The function should provide the user with a way to abort the entry process.
b. Handle invalid inputs.
c. Return a valid number or whatever you are using to signify that the user wishes to
exit the program. I suggest using a value of 0.
3. The main program should do the following.
a. Create a list of years containing 1500, 1900, 2000, 2001, 2002, 2003, and 2004.
b. Call your function to determine whether the years in the list are leap years and
output the year and whether or not it is a leap year. If the leap year calculation
was not valid for the year it should print a message to that effect.
c. Have a loop to allow the user to determine whether additional years are leap
years. After each year is entered, the program should indicate whether the year is
a leap year. Of course, it should include a way for the user to exit the loop and
end the program.
d. Since the output for items 3.b and 3.c are the same, you could create an additional
function to be called to print the results out for each year. Using an additional
function for printing the results is an option and is not a requirement.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr