Function Name: leapYear Parameters: year – an nonnegative integer representing the year Test Cases: >>>leapYear(1996) The year 1996 is a leap year. Enjoy your extra day! >>>leapYear(1901) The year 1901 is not a leap year. Description: Write a function which calculates whether or not a given year is a leap year and has 366 days instead of 365. A general algorithm is as follows: 1. A year will be a leap year if it is divisible by 4 but not by 100. 2. If a year is divisible by 4 and by 100, it is not a leap year unless it is also divisible by 400. Years such as 1996, 1992, 1988 and so on are leap years because they are divisible by 4 but not by 100. For century years, the 400 rule is important. Century years (ex: 1900, 1800, 1700) are exactly divisible by 4 AND exactly divisible by 100. They are not divisible by 400 and are thus not leap years. You fuction should print out "The year XXXX is a leap year. Enjoy your extra day!" if the year XXXX is a leap year. Print "The year XXXX is not a leap year." if the year XXXX isn't a leap year

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section: Chapter Questions
Problem 3PP
icon
Related questions
Question

Function Name: leapYear Parameters: year – an nonnegative integer representing the year Test Cases: >>>leapYear(1996) The year 1996 is a leap year. Enjoy your extra day! >>>leapYear(1901) The year 1901 is not a leap year. Description: Write a function which calculates whether or not a given year is a leap year and has 366 days instead of 365. A general algorithm is as follows: 1. A year will be a leap year if it is divisible by 4 but not by 100. 2. If a year is divisible by 4 and by 100, it is not a leap year unless it is also divisible by 400. Years such as 1996, 1992, 1988 and so on are leap years because they are divisible by 4 but not by 100. For century years, the 400 rule is important. Century years (ex: 1900, 1800, 1700) are exactly divisible by 4 AND exactly divisible by 100. They are not divisible by 400 and are thus not leap years. You fuction should print out "The year XXXX is a leap year. Enjoy your extra day!" if the year XXXX is a leap year. Print "The year XXXX is not a leap year." if the year XXXX isn't a leap year

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Function Arguments
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning