The Julian calendar was a reform of the Roman calendar introduced by Julius Caesar in 46 BC
Question:
“The Julian calendar was a reform of the Roman calendar introduced by Julius Caesar in 46 BC (708 AUC). It took effect in 45 BC (709AUC). It was the predominant calendar in most of Europe, and in European settlements in the Americas and elsewhere, until it was superseded by the Gregorian calendar.
The Julian calendar has a regular year of 365 days divided into12 months, as listed in Table of months. A leap day is added to February every four years. The Julian year is, therefore, on average 365.25 days long. It was intended to approximate the tropical (solar) year. Although Greek astronomers had known, at least since Hipparchus, that the tropical year was a few minutes shorter than 365.25 days, the calendar did not compensate for this difference. As a result, the calendar year gained about three days every four centuries compared to observed equinox times and the seasons. This discrepancy was corrected by the Gregorian reform of 1582. The Gregorian calendar has the same months and month lengths as the Julian calendar, but inserts leap days according to a different rule. Consequently, the Julian calendar is currently 13 days behind the Gregorian calendar; for instance, 1 January in the Julian calendar is 14 January in the Gregorian.
The Julian calendar has been replaced as the civil calendar by the Gregorian calendar in almost all countries which formerly used it, although it continued to be the civilcalendar of some countries into the 20th century.Most Christian denominations in the West and areasevangelized by Western churches have also replaced the Juliancalendar with the Gregorian as the basis for their liturgicalcalendars. However, most branches of the Eastern OrthodoxChurch still use the Julian calendar for calculating the datesof moveable feasts, including Easter (Pascha). SomeOrthodox churches have adopted the Revised Julian calendarforthe observance of fixed feasts, while other Orthodox churchesretain the Julian calendar for all purposes.[1] TheJulian calendar is still used by the Berberpeople of North Africa and on Mount Athos. Inthe form of the Alexandrian calendar, it is the basis forthe Ethiopian calendar, which is the civil calendar ofEthiopia.”[1]
The major difference to the Julian calendar made by theGregorian calendar as explained above is the new rule fordetermining a leap year. This is summarized as follows:
Gregorian Calendar Rule for determining a leapyear: A year is a leap year if it is divisible by 4,unless, it is divisible by 100, in which case it’s not a leap year,UNLESS it’s also divisible by 400, in which case it is a leapyear.
Some of the basic facts regarding our Julian and Gregoriancalendars are the following:
Non – leap years have only 365 days
Leap years consist of 366 days where the additional day is addedto the month of February (29th)
Number of non-leap year days in each month are as follows:Jan-31, Feb-28, Mar 31, Apr 30, May 31, Jun 30, Jul 31, Aug 31, Sep30, Oct 31, Nov 30, Dec 31
Part A:
Write a program that will output the number of regular occurringleap years as calculated using the Gregorian calendar leap yearrule since the Gregorian Reform year of 1582. The program will alsodisplay the actual leap years that have occurred since thenincluding 1582 if that year so happened to qualify as a leap year.The first part of the output will be a list of 4 digit years withmultiple years displayed on a line separated by blank spaces withno more than 16 leap years appearing on any single line.
The second part of the output will simply display the number ofthe leap years that have occurred since the Gregorian Reformyear.
Attached is the output required of your program:
Leap Years Since Gregorian Reform Year of1582:
1584 1588 1592 1596 1600 1604 1608 1612 1616 1620 16241628 1632 1636 1640 1644
1648 1652 1656 1660 1664 1668 1672 1676 1680 1684 16881692 1696 1704 1708 1712
1716 1720 1724 1728 1732 1736 1740 1744 1748 1752 17561760 1764 1768 1772 1776
1780 1784 1788 1792 1796 1804 1808 1812 1816 1820 18241828 1832 1836 1840 1844
1848 1852 1856 1860 1864 1868 1872 1876 1880 1884 18881892 1896 1904 1908 1912
1916 1920 1924 1928 1932 1936 1940 1944 1948 1952 19561960 1964 1968 1972 1976
1980 1984 1988 1992 1996 2000 2004 20082012
Total number of Leap Years since 1582 = 105
Note design your program so that this particular function can becalled upon by other parts of this extra credit exercise.
Part B:
Write a program that will output the leap years as calculatedusing the Julian calendar leap year rule since manfirst started using that calendar in 46 BC. The program will alsodisplay the number of leap years using the Julian rule that haveoccurred since 46BC and including 46 BC if that year so happened toqualify as a leap year.
The first part of the output will be a list of years withmultiple years displayed on a line separated by blank spaces withno more than 16 Julian leap years appearing on any single line.Note that the years BC should be display with two digit yearfollowed by the string “BC” as follows:
Leap Years Since Julian Calendar Instituted in46BC:
44BC 40BC 36BC … … …
The second part of the output will simply display the number ofthe Julian leap years that have occurred since that calendar wasfirst used.
Part C:
Write a program that displays the year(s) when both Julian andGregorian leap year rules coincided, that is, both rules determinedthat the year was a leap year. Your program should also display thetotal number of these years that have occurred till today.
Hint: For this part of the exercise, you may want to use a datatype that can store the values of the leap years as determined forboth calendar types in the previous functions created. An integerarray will do nicely and can be passed between functions as apointer to an integer as follows:
int GregorianLeapYears[600]; // declaration
leapYearsSinceGregorianReform( GregorianLeapYears ); //call to function with array
int leapYearsSinceGregorianReform(intGregorianLeapYears[]);
{
// find the leapyears and copy them into GregorianLeapYears[] array
return (#_of_gregorian_leap_years );
}
Doing the same for the Julian leap years will provide you withtwo integer arrays that you can then compare to see if the sameyear(s) appear in each array. Such a hit is what you are lookingfor. Returning the number of leap years detected can be used asboundary values for your comparison algorithm.
Part D:
Using the Gregorian calendar rules, write a program to print acalendar for any month of any year from the year 1900 on. Here is a sample run, with user input in boldface:
Enter month number: 13
Month must be between 1 and 12, please re-enter:11
Enter year: 90
Year must be 1900 or later, please re-enter:1990
November, 1990
S M T W T F S
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30
This appears to be a simple problem but it is rich insub-problems . It turns out that most of the program involvesfinding the day of the week on which the month starts. You do thisby knowing that January 1, 1900 fell on a Monday, and then findingthe number of days that have occurred between that day and thefirst day of the month that the user has entered inclusive.
This difference modulo 7 tells you the day of the week using this “day-of-the-week, number key” : Sun=0, Mon=1,Tue=2, Wed=3,Thu=4,Fri=5,Sat=6.
Example 1: User enters month 3 and year1900:
Since we are looking for the day of the week on which March 1occurs in the same year as 1900, the number of this calendar day inthe year 1900 is the number of days that have occurred in Januaryand February or 31 + 28 + 1 = 60. The “+1” includes the target dayof March 1, 1990. If this had been a leap year which it was not,March 1 would have been the 61st day of the yearinstead it is the 60th day. Knowing thenumber of days having occurred since 1/1/1900, we can modulo 7 thatnumber or 60 % 7 = 4. Based on the previous day-of-the-week, numberkey, the 4th day of the week is Thursday, therefore,March 1, 1900 fell on a Thursday.
Example 2: User enters month 1 and year1901:
A full year expired from 1/1/1900 to 1/1/1901. Since we knowthat 1900 was not a leap year, the number of days difference is 365+ 1 = 366. Had 1900 been a leap year, the number of days differencewould have been 366 + 1 = 367. 366 % 7 = 2, therefore, January 1,1901 fell on a Tuesday.
Example 3: User enters month 9 and year2013:
One hundred and twelve years have expired since 1/1/1900, inaddition to eight full months from January up to September. Withoutcounting leap years that have occurred during this period thenumber of days occurred is calculated as follows : (365 * 113) +31+ 28 + 31 + 30 + 31 +30 + 31 + 31 +1 = 41,245 + 243 + 1 = 41,489 days.
The number of leap years that have occurred between 1900 and2013 are 28. They include:
1904 1908 1912
1916 1920 1924 1928 1932 1936 1940 1944 1948 1952 1956 1960 19641968 1972 1976
1980 1984 1988 1992 1996 2000 2004 2008 2012
We therefore add 28 to our previous total : 41,489 + 28 =41,517
41,517 % 7 = 0
September 1, 2013 fell on a Sunday.
Hints
Finding the number of days from 1/1/1900 to the first day of anyother month can be broken down into the following sub-problems:
Determine the number of days that have occurred between thefirst day of the month and year entered and January 1, 1900. Don’tforget to add a one to be inclusive.
Determine the number of leap years that have occurred during theinterval in question. Add 1 for each leap year encountered.
Use the “day-of-the-week, number key” mapping to findwhich day of the week the first of the user specified month fellon.
Some functions that you might find useful to create:
A function that determines if a specified year is a Gregoriandefined leap year.
A function that determines the number of leap years that haveoccurred during a specified range of years (i.e.,findNumOfLeapYears( 1900, 2013); ).
A function that given a month and a year, returns the number ofdays in that month.
A function that given a month determines the numbers of daysthat have transpired since the beginning of the year
A function that given a month of the year and the day of theweek on which the first day of the month occurs, prints a calendarof that month
You may also find the following named constant string and intliteral arrays useful:
constint days_in_month[13] = {
0, 31, 28, 31, 30, 31, 30, 31, 31, 30,31, 30, 31
};
conststring monthName[] = {
“ “, "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November","December"
};
constint daysSinceStartOfYear[13] = {
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
};
Good luck!
[1] http:/en.wikipedia.org/wiki/Julian_calendar
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill