Lab 4 - Day Calculation

Background - Many times one needs to do calculations on dates.  Programs like Excel use the number of days since 1/1/1900 a particular date is when doing these calculations.  We don't know enough C++ to completely do this calculation, yet, but we can make a start.

Problem - You will prompt a user for a month, a day and a year.  You will then tell the user how many days since January 1 of that year the input date is.  For example if the user inputs a 3 for the month, a 2 for the date, and 2000 for the year the program outputs the number of days as being 62.  Note 2000 is a leap year.  Therefore you must test to see if a year is a leap year when doing this problem.  A year is a leap year if it is divisible by 4 but years that are centennial years that are not divisible by 400 are not leap years.  Therefore the years 1900, and 2100 are NOT leap years.

Method - Use if -else  or case statements to decide:

1. How many days to add given the month
2. Whether to add an additional day for leap year.
3. Don't forget to add in the days for the current date within a month

Ex. if the user inputs month = 4, day = 22, year = 1995

Since 1995 is not a leap year add 90 days (total for January, February, and March) then to that add 22 for the number of days in April for a total of 112 days.

Be careful!!  How many days do you need to add for a leap year whose given date is before February 29??

Output - Organize your prompts, and output in a neat orderly fashion.  Print a statement telling whether the year is a leap year and another statement about the number of days since January 1 of that year has past.

Test your program with the following dates:

January 12, 1996

June 30, 1900

October 31, 2001

May 16, 2000

and two more dates of your own choosing.