## Description

Part 1

You are to write a program that determines the day of the year for a given date and the number of days between two dates, and the day upon which Easter falls for a given year.

Your program should provide the following functions:

** preconditions are assumed to be true by a function. If a function has a precondition, it should be checked by thecalling function

bool validMonth(int month)

This function returns true if the value of month is between 1 and 12 inclusive. If an

invalid month value is provided, the value false is returned.

bool validYear(int year)

A valid year is greater than 1582. This function returns true if the year parameter is valid, and false

otherwise.

Precondition: the year is greater than 1582

bool leapYear(int year)

A year is a leap year if it is divisible by 4. However, a year is not a leap year if it is divisible by 100

unless it is also divisible by 400. This function returns true IF the year is a leap year, and returns false

otherwise.

Precondition: the month is valid

bool validDay(int year, int month, int day)

The valid day range depending on the month (Sept, April, JUNE, and November have 30 days, Feb 28 or

29, other months have 31 days. If an invalid data is given this function returns false, otherwise true is

returned. (Yes, you may need to check if it is a leap year)

void getData(int& month, int& day, int& year)

This function prompts the user for a month, day and year. The values are to be read, verified, and

returned to the user through the parameter list.

Precondition: the year is greater than 1582

void easterDate (int& month, int& day ,int year)

This function returns the the day and month of the year on which Easter will occur. These values will be

returned thru the parameter list.

Divide year by 19 and call the remainder a. Ignore the quotient

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

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

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

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

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

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

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

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

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

Then Easter falls on day p of month n.

For example, if year 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 So in 2001, Easter Sunday fell on April 15.

Precondition: the first date is earlier than the second date

int daysBetween(int month1, int day1, int month2, int day2, int year)

This function returns the number of days between day1,month1 and day2,month2 for the given year.

Precondition: day and month are valid ranges

int dayOfYear (int day, int month , int year)

This function returns the the day of the year for the given date. That is, if the date is Jan 2 the day

number is 2. If the date is Feb 2, the day of the year is 33 . If the date is March 3 and it is NOT a leap

year, the day of the year is 62.

Your user interactive program should allow the user to perform any of the following actions . The program should process requests until the user indicates that he/she wishes to exit.

• Allow user to enter a day, month,and year. Output the day of the year. The the date is not valid, an error message is given, and no number is s determined.

• Allow user to enter a year, and output the month and day that Easter will occur in that year.

• Allow user to enter two dates in the same year (month1, day1, month2, day2, and a year) and outputs the number of days between the two dates. The program should print an error message if the first date is not earlier than the second date.

Be sure to code and use functions as specified. Pay attention to coding style issues such as variable names, spacing and indentation. Additionally, use constant variables to represent values in each of the formula calculations.

Part 2

Write a recursive C++ function which accepts one int parameter and returns the number of even digits in this int value. Write a short C++ main which reads in int value and calls this function.

Please note:

Students are to submit solution files as email attachments. Traditional students must also hand in a printout of the .cpp file being submitted. In either case, only submit the .cpp file requested, I do not need or want any other project files.