As discussed in Student Lesson A3, the naming of variables is very important. The names should be descriptive and to the point. However, when working with any type of algorithm or formula that may be presented to you, it is always better to use the variables names that are used in the given algorithm/formula. This reduces potential confusion that may arise if the algorithm/formula named something “a” and you renamed it “netIncome”. This becomes quite clear in this assignment because if you try to change the names that are given, you would have to remember to translate from one variable name to the other.
A convenient algorithm for determining the date of Easter in a given year was devised in 1876 and first appeared in Butcher’s Ecclesiastical Handbook. This algorithm holds for any year in the Gregorian calendar, which means years including and after 1583. Subject to minor adaptations, the algorithm is as follows:
Therefore, in 2003, Easter fell on April 20 (month = n = 4 and day = p + 1 = 20).
-
Write a program to solve for the day that Easter falls on for a given year.
The program should display the values for all of the variables and the date for Easter. A Sample run output for the year 2003 would be:
a = 8
b = 20
c = 3
d = 5
e = 0
f = 1
g = 6
h = 26
i = 0
k = 3
r = 3
m = 0
n = 4
p = 19
Easter in 2003 falls on 4/20
Verify that the program gives the correct date of Easter for the current year.
After completing the program, submit your program.