CS303E Assignment 2: Easter Sunday

Due Friday, Feb. 1st by 11pm


In this program you will compute the date of Easter Sunday, which is the first Sunday after the first full moon of Spring. With this program, those of you who care about Easter Sunday will be able to determine when it is years into the future, and those of you that don't can determine when to not go out to lunch. Regardless, you'll get practice using variables, arithmetic operators, and the print statement.

This algorithm was invented by Carl Friedrich Gauss.

  1. Let y be the year (such as 2001).

  2. Divide y by 19 and call the remainder a. Ignore the quotient.

  3. Divide y by 100 to get a quotient b and a remainder c.

  4. Divide b by 4 to get a quotient d and a remainder e.

  5. Divide 8 * b + 13 by 25 to get a quotient g. Ignore the remainder.

  6. Divide 19 * a + b - d - g + 15 by 30 to get a remainder h. Ignore the quotient.

  7. Divide c by 4 to get a quotient j and a remainder k.

  8. Divide a + 11 * h by 319 to get a quotient m. Ignore the remainder.

  9. Divide 2 * e + 2 * j - k - h + m + 32 by 7 to get a remainder r. Ignore the quotient.

  10. Divide h - m + r + 90 by 25 to get a quotient n. Ignore the remainder.

  11. Divide h - m + r + n + 19 by 32 to get a remainder p. Ignore the quotient.

Easter Sunday falls on day p of the month n. For example if y is 2001: Hence in 2001, Easter Sunday was on April 15th.

In your program you will prompt the user to enter the year and then write out the date for Easter Sunday.

Here is a program template that you may use. The code to accept input and make a decision has been provided for you. You may not use any concept that has not been introduced in class.

You will need to write the output statements yourself.

Your session will look like this:

Enter year: 2001

Easter Sunday was on 4 / 15 / 2001

You also want to make sure that the tense for the verb is correct. For years before 2012, the statement should say "Easter Sunday was on ...". For the year of and years after 2012, the statement should say "Easter Sunday will be on ...".

Be certain to test your code! You can go to the US Naval Observatory website and check your result:

http://aa.usno.navy.mil/faq/docs/easter.php

Include your test cases and their output in comments at the end of your program. Add at least 5 test cases and be sure to test strange (edge, unexpected, intresting) cases. So after the final statement of your program, main() add test cases such as this:

main() 
#test case 1
#Enter year:2010
#Easter Sunday was on 4 / 4 / 2010


#test case 2
#Enter year:2014
#Easter Sunday will be on 4 / 20 / 2014

The program that you will be writing will be called EasterSunday. We will be looking at good documentation, and adherence to the coding conventions discussed in class. You may use the same variable names used in the problem statement. Your file EasterSunday.py will have the following header:

# File: EasterSunday.py
# Description:
# Assignment: 2
#
# Student Name:
# EID:
# Course Name: CS 303E
#
# Unique Number:
#
# Date Created:
# Date Last Modified:
#
# Slip days used this assignment:
# Total slip days used:

Use the turnin program to submit your EasterSunday.py file by 11p on Friday, Feb 1st.