Write this in c++
Leap year and Second in year program
- Whether a year is a leap year on not a leap year.
- The number of seconds in a year. (FYI, it will be a differentamount for leap vs non-leap year.) You can calculate the seconds bywhatever means you choose, whether with defined constants andcalculations or just calculations. It is your choice.
- If the user inputs a year number greater than zero, the programreturns how many seconds were or will be in that year.
- Put in descriptions for your request for input. If you do thebonus portion, also put that in for your request.
- Tell the user that an input of -99 ends the program. (+5)
Put your prompt in a loop, asking the user each time what year tocheck. (+5) - You should assume a day length of exactly 24 hours. Obviously,multiplying 365*24*3600 isn’t exactly a programming challenge, andit won’t even give the right answer for all years.
- You must take account of leap years, which means your yearswill not all have the same number of days. If you do not alreadyknow, here is the calculation for leap years:
1. If a year is divisible by 4 with no remainder, it is a leapyear,
2. unless it is a centurial year (ending in 00).
3. Then it is not a leap year,
4. unless it is a year divisible by 400, in which case it is stilla leap year.
For example:
1904 is a leap year—evenly divisible by 4.
1900 is not a leap year—it is evenly divisible by 4, and alsoevenly divisible by 100. However, it is not evenly divisible by400.
2000 is a leap year— it is evenly divisible by 4, evenly divisibleby 100, but also evenly divisible by 400.
Your calculation should ignore all other variations in the lengthof the calendar year, such as leap seconds or the change from theJulian to the Gregorian system.
Expert Answer
Answer to Write this in c++ Leap year and Second in year program Whether a year is a leap year on not a leap year. The number of s…