## CS 115 Lab 4 If statements - Easter Date (Team)

### 80 Points

Due Date: Monday February 12 by the end of the lab session

Educational goals of this lab - verify that every student can

• understand and write if statements
• understand arithmetic operators // and %

INSTRUCTIONS:

(80 points) Description of the Problem:

• You want determine the date for the next Easter holiday. The holiday does not fall on the same day of the month every year. It actually uses the lunar calendar.
• Here is the algorithm for doing it that you are supposed to use. https://www.assa.org.au/edm#Computer
• (50 points) It is written in Basic; your job is to translate it to Python. The program given in Basic does not have input or output statements, you'll have to add those. Ignore the "Sub EasterDate (d, m, y)" at the top of the function; use a main function as usual.
• Change variable names when you feel safe in doing so - for example, the y is really the year that is input from the user.
• Ignore the "return the date" comment at the end of the function; just output the results there in a readable format. Hint: a month variable with a value of 3 is which month? 4 is which month? Use strings instead of numbers; makes the output easier.
• The "select case" statement means that if FirstDig is 21 or 24 or ..., then subtract one from temp, otherwise if FirstDig is 33 or 36 or 37, ... then subtract two from temp. You should use the "or" logical operator there instead of making many different if statements.
• They use the word "mod" when you will use the mod operator. They use the "\" operator but NOT to mean escape. It has the same meaning as floor division.
• Use augmented operators as often as possible.
• The output should be what appears in the sample runs. Get the spacing on the comma with sep=.
• Sample run:
```Enter the year: 2016
Easter is on March 27, 2016
```

Another run:

```Enter the year: 2299
Easter is on April 16, 2299
```
• (10 points) Keep the comments from the given Basic program, as much as possible. Also add in the usual prolog with team members' names, purpose, pre- and post-conditions.
• (10 points) Run at least 8 test cases. There is a table at the top of the same page as where the Basic program is, with lots of dates for Easter. https://www.assa.org.au/edm Make sure you test ones where the month is April and cases where the month is March. Put the test plan of ALL the tests you run at the bottom of your source file in a comment. What is the earliest date Easter can fall on? the latest? Put those in the comment too.
• (10 points) Modify the program you wrote so that it produces a table of the dates for Easter between the years 1800 and 1899, inclusive. This will not require any input from the user at all, and a little extra work with output formatting. Using end="something" will be necessary. Think about the tab character. Note that this is NOT the same layout as the tables on the web page. That layout is a fair bit more work! Yes, you should use one for loop.
```April 13, 1800   April 5, 1801   April 18, 1802  April 10, 1803
April 1, 1804    April 14, 1805  April 6, 1806   March 29, 1807
April 17, 1808   April 2, 1809   April 22, 1810  April 14, 1811
March 29, 1812   April 18, 1813  April 10, 1814  March 26, 1815
April 14, 1816   April 6, 1817   March 22, 1818  April 11, 1819
April 2, 1820    April 22, 1821  April 7, 1822   March 30, 1823
April 18, 1824   April 3, 1825   March 26, 1826  April 15, 1827
April 6, 1828    April 19, 1829  April 11, 1830  April 3, 1831
April 22, 1832   April 7, 1833   March 30, 1834  April 19, 1835
April 3, 1836    March 26, 1837  April 15, 1838  March 31, 1839
April 19, 1840   April 11, 1841  March 27, 1842  April 16, 1843
April 7, 1844    March 23, 1845  April 12, 1846  April 4, 1847
April 23, 1848   April 8, 1849   March 31, 1850  April 20, 1851
April 11, 1852   March 27, 1853  April 16, 1854  April 8, 1855
March 23, 1856   April 12, 1857  April 4, 1858   April 24, 1859
April 8, 1860    March 31, 1861  April 20, 1862  April 5, 1863
March 27, 1864   April 16, 1865  April 1, 1866   April 21, 1867
April 12, 1868   March 28, 1869  April 17, 1870  April 9, 1871
March 31, 1872   April 13, 1873  April 5, 1874   March 28, 1875
April 16, 1876   April 1, 1877   April 21, 1878  April 13, 1879
March 28, 1880   April 17, 1881  April 9, 1882   March 25, 1883
April 13, 1884   April 5, 1885   April 25, 1886  April 10, 1887
April 1, 1888    April 21, 1889  April 6, 1890   March 29, 1891
April 17, 1892   April 2, 1893   March 25, 1894  April 14, 1895
April 5, 1896    April 18, 1897  April 10, 1898  April 2, 1899
```
• Submit your finished program with the link above. Use the Lab 4 and Code menu choices.

Log off properly - you don't want your account misused by someone else!

Remember NOT to leave files on the local hard drives in this lab or anywhere else on campus! Make sure you save your projects onto a portable storage device you take with you!