Question: 2. Given a date, it is possible to determine the day of the week for that date using the following algorithm (use integer division throughout):

 2. Given a date, it is possible to determine the day

2. Given a date, it is possible to determine the day of the week for that date using the following algorithm (use integer division throughout): Let y be the 4-digit year, m be a 2-digit value corresponding to the month (for example, for March m= 3, and for November m= 11), and d be the 2-digit day. If m is equal to 1 or 2 then reduce y by 1. Set p last two digits of y. Set q = first two digits of y. Set r = ((m +9) mod 12) +1. Set s= 13; -1 Set t= 1 Set u= 4. Set v = d+p+s+t+u+5q. Set w = v mod 7. The day of the week is given by the value of w, where w = 0) would be Sunday. Write a Fortran program to implement this algorithm, asking the user for the year, month and day (each in the form of a numerical value). Your code should include the following functions: FUNCTION day_name(d) that returns the name of the day for a given value of d. FUNCTION month_name(m) that returns the name of the month for a given value of m. Sample output: February 13, 2012 is a Monday. 2. Given a date, it is possible to determine the day of the week for that date using the following algorithm (use integer division throughout): Let y be the 4-digit year, m be a 2-digit value corresponding to the month (for example, for March m= 3, and for November m= 11), and d be the 2-digit day. If m is equal to 1 or 2 then reduce y by 1. Set p last two digits of y. Set q = first two digits of y. Set r = ((m +9) mod 12) +1. Set s= 13; -1 Set t= 1 Set u= 4. Set v = d+p+s+t+u+5q. Set w = v mod 7. The day of the week is given by the value of w, where w = 0) would be Sunday. Write a Fortran program to implement this algorithm, asking the user for the year, month and day (each in the form of a numerical value). Your code should include the following functions: FUNCTION day_name(d) that returns the name of the day for a given value of d. FUNCTION month_name(m) that returns the name of the month for a given value of m. Sample output: February 13, 2012 is a Monday

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!