CISH-4020 Object Structures
Assignment 1

Write a program to compute the date of Easter Sunday. Easter Sunday is the first Sunday after the first full moon of Spring. Use the following algorithm, invented by the mathematician Carl Friedrich Gauss in 1800 (note: this algorithm is only valid for dates after 326AD in the Julian calendar):

  1. Let y be the year (such as 1800, or 2001)
  2. Divide y by 19 and call the remainder a. Ignore the quotient.
  3. Divide y by 100 to get the quotient b and remainder c
  4. Divide b by 4 to get a quotient d and remainder e
  5. Divide 8 * b + 13 by 25 to get the 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 the quotient j and remainder k
  8. Divide a + 11 * h by 319 to get the 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 the quotient n. Ignore the remainder.
  11. Divide h - m + r + n + 19 by 32 to get a remainder p. Ignore the quotient.

After all that, you will find that Easter falls on day p of month n. For example, if y is 2001:

a = 6
b = 20
c = 1
d = 5, e = 0
g = 6
h = 18
j = 0, k = 1
m = 0
r = 6
n = 4
p = 15
	

Therefore, in 2001, Easter Sunday fell on April 15.

Write a class EasterSunday with methods getEasterSundayMonth, getEasterSundayDay, and getEasterSundayYear. The constructor for EasterSunday will take a single integer parameter representing the year in question. getEasterSundayDay and getEasterSundayYear will return integer values, while getEasterSundayMonth will return the name of the month. Be sure to follow the class coding guidelines - however, for this assignment you can ignore the rules governing variable naming as well as the admonitions against magic numbers for the code representing Gauss' equations

You'll also need a driver class to test your EasterSunday class. The app class will ask the user for year to compute the date of Easter Sunday. It will then report the date of Easter Sunday for the given year. Your driver class should loop until the user enters 0 for the year.

Since we won't be covering exceptions and I/O until next class, you'll need help getting input from the keyboard. You can use the CS1 jar file which contains the Keyboard class for your input needs. Refer to the Eclipse documentation to include the jar in your project.

Your output should look like the following (user input in green):


Determine Easter Sunday for what year:  2005
In 2005 Easter Sunday falls/fell on March, 27.

Determine Easter Sunday for what year:  2000
In 2000 Easter Sunday falls/fell on  April, 23.

Determine Easter Sunday for what year:  2006
In 2006 Easter Sunday will falls/fell on  April, 16.

Determine Easter Sunday for what year:  1990
In 1990 Easter Sunday falls/fell on  April, 15.

Determine Easter Sunday for what year:  1976
In 1976 Easter Sunday falls/fell on  April, 18.

Determine Easter Sunday for what year:  0
Goodbye! 

Submit your .java files to blought@rh.edu no later than 5:00pm on 5/18/04. Your code will be graded on correctness, output, reusability, readability, and documentation.



Last Updated: Monday, May 10 2004 03:34
Rensselaer at Hartford, 275 Windsor St, Hartford, CT 06120
For more information: 1-800-433-4723 or info@rh.edu
Please send questions, comments or suggestions to webmaster@rh.edu