Lab 1: Easter Sunday
Web-CAT: Submit Java
programs to this automated grading platform.
Background
- Due Date: Thursday, September 12, 2019
- Total Points: 10
- In this lab, you must write a
Java
program that determines which particular day and month that Easter Sunday appears.
Code Distribution
Description | File Size | File Name |
---|---|---|
Java Source Code for Easter Sunday |
4.8KB | lab01.zip |
Contents of lab01.zip
:
Lab01EasterSunday/
├── EasterSunday.class
├── EasterSunday.ctxt
├── EasterSunday.java
├── EasterSundayJUnitTest.class
├── EasterSundayJUnitTest.ctxt
├── EasterSundayJUnitTest.java
├── package.bluej
└── README.TXT
Specification
- Write a
Java
program in the fileEasterSunday.java
that computes the date of Easter Sunday, given a particular year. Easter Sunday is a holiday which falls on the first Sunday after the first full moon of Spring. This algorithm was discovered by Carl Friedrich Gauss. - The parameter
year
is the variable for the year in question. In the provided code,year
takes on the value2001
. - Your program must perform the following calculations:
- Divide
year
by19
and call the remaindera
. Ignore the quotient. - Divide
year
by100
to get a quotientb
and a remainderc
. - Divide
b
by4
to get a quotientd
and a remaindere
. - Divide
(8 * b + 13)
by25
to get a quotientg
. Ignore the remainder. - Divide
(19 * a + b - d - g + 15)
by30
to get a remainderh
. Ignore the quotient. - Divide
c
by4
to get a quotientj
and a remainderk
. - Divide
(a + 11 * h)
by319
to get a quotientm
. Ignore the remainder. - Divide
(2 * e + 2 * j - k - h + m + 32)
by7
to get a remainderr
. Ignore the quotient. - Divide
(h - m + r + 90)
by25
to get a quotientn
. Ignore the remainder. - Divide
(h - m + r + n + 19)
by32
to get a remainderp
. Ignore the quotient. - The result is that Easter Sunday falls on day:
p
of the month:n
.
- Divide
- For example, given the year
2001
, we find that the result is:n = 4
andp = 15
. This means that Easter Sunday was on April 15 in the year 2001. - You will write your solution in a function called
retrieveDate(int year)
, right below the place where it says:YOUR CODE HERE
.
Testing
- Click on the Run Tests button to execute the
JUnit
test bench.JUnit
indicates a successful test with a green bar, and an unsuccessful test with a red bar.
Submission
- Upload the file
EasterSunday.java
to the Web-CAT automated grading platform.