If you have no prior programming experience I recommend starting the assignment after lecture on Monday, June 10.
Review the assignment guidelines.
Write a program to calculate the month and day of the Easter holiday for any given year using a provided formula. Put all your code in a function named main, and call the main function at the bottom of the program. (Same as the examples from class such as https://www.cs.utexas.edu/~scottm/cs303e/handouts/sample_code/calculate_age.py.)
Easter Sunday is the Easter Sunday is the first Sunday after the first full moon of spring. When determining the date of Easter, Spring is defined to start on March 21.
This algorithm, known as the
Computus, was invented by the mathematician
Carl Friedrich Gauss:
Ask the user for the year (such as 2001). Save the year in a variable named
year.
All division operations done as part of the following algorithm shall be Python's floor division operator. (//)
Divide year by 19 and call the remainder lunar_year_cycle_position. Ignore the quotient. In other words use the modulus operator.
Divide year by 4 and call the remainder weekday_slide_part_1. Ignore the quotient. In other words use the modulus operator.
Divide year by 7 and call the remainder weekday_slide_part_2. Ignore the quotient. In other words use the modulus operator.
Divide year by 100 and call the quotient leap_year_100.
Divide leap_year_100 by 4 and call the quotient leap_year_400.
Set the variable lunar_orbit_correction to (13 + 8 x leap_year_100) divided by 25.
Set the variable century_start to the remainder of the expression (15 - lunar_orbit_correction + leap_year_100 - leap_year_400) divided by 30.
Set the variable sunday_offset to the remainder of the expression (4 + leap_year_100 - leap_year_400) divided by 7.
Set the variable days_added to the remainder of the expression (19 x lunar_year_cycle_position + century_start) divided by 30.
Set the variable day_of_week_offset to the remainder of the expression (2 x weekday_slide_part_1 + 4 x weekday_slide_part_2 + 6 x days_added + sunday_offset) divided by 7.
Set the variable total_days_added to 22 + days_added + day_of_week_offset
Set the variable day_of_easter to the remainder of the expression total_days_added divided by 31.
Set the variable month_of_easter to 3 + (total_days_added divided by 31)
Then Easter Sunday falls on day day_of_easter of the month month_of_easter. For
example, if y is 2001:
lunar_year_cycle_position = 6
weekday_slide_part_1 = 1
weekday_slide_part_2 = 6
leap_year_100 = 20
leap_year_400 = 5
lunar_orbit_correction = 6
century_start = 24
sunday_offset = 5
days_added = 18
day_of_week_offset = 6
total_days_added = 46
day_of_easter = 15
month of easter = 4
Based on the algorithm in the year 2001 Easter should have been the 15th day of
the 4th month (April).
There are some special cases in the algorithm that have not been described and
you are not to implement. See the Wikipedia article for more details if you are
interested. We shall not test these special cases.
Your program shall prompt the user to enter the year and then write out the date for Easter Sunday.
When run, your program must look exactly like the following. Any deviations in the format of the output will result in points being deducted.
Enter year: 2001 In 2001 Easter Sunday is on 4/15/2001.
Recall, you must include and fill out the header for the assignment and place it at the top of the program. Replace any items in <> with the proper information and delete the <>.
# File: easter_date.py
# Description:
<A DESCRIPTION OF YOUR PROGRAM>
# Assignment Number: 2
#
# Name: <YOUR
NAME>
# EID: <YOUR EID>
# Email: <YOUR EMAIL>
#
Grader: <YOUR GRADER'S NAME Mayra OR Risha>
# Slip days used this assignment: <#>
#
# On my
honor, <YOUR NAME>, this programming assignment is my own work
# and I have
not provided this code to any other student.
.