Day of the Week (Due 28 September 2012)

In this program you will prompt the user to enter the day, month, and year. Your program will print out the day of the week for that date. Here is a sample output for the program:
Enter day, month, year: 12, 12, 1960

The day is Monday.

All the input values will be positive integers. The day will be in the range 1 through 28 to 31 depending on the month. The month will be in the range 1 through 12 where 1 is for January and 12 is for December. The year will be a four digit number in the range 1900 through 2100.

Your program will check the following: All the above limits are inclusive. If any one of the conditions fails then the program will keep prompting the user to enter the values. You will have to use a loop to achieve that. You will need to check that the user has entered the correct day for the given month. For example, the user can not enter 31 for the day in the month of April. You will have to check if the year is a leap year or not if the user enters 29 for a day in February. For example the input 29, 2, 2012 is valid but the input 29, 2, 1900 is not.

This algorithm was developed by Rev. Zeller. Let us define the quantities a, b, c, and d as follows:

Important: In our calendar, the year begins in January and ends in December. In the calendar, used in the algorithm, the year begins in March and ends in February. Your program should internally make the adjustment and not expect the user to know this. For example, if in our calendar we have January 2009 (month = 1 and year = 2009), the program will make the adjustment so that month = 11 and year = 2008. If you do not make the adjustment you will not get the right result.

For example, 31 July 1929, gives a = 5, b = 31, c = 29, and d = 19. Similarly, 3 January 1988, gives a = 11, b = 3, c = 87, and d = 19.

Now compute the following quantities:

r gives the day of the week. r = 0 represents Sunday, r = 1 represents Monday, and so on.

The program that you will be writing will be called Day.py. We will be looking at good documentation, design, and adherence to the coding convention discussed in class. You may use the same variable names used in the problem statement or come up with your own. Your file Day.py have the following header:


#  File: Day.py

#  Description:

#  Student Name:

#  Student UT EID:

#  Course Name: CS 303E

#  Unique Number: 

#  Date Created:

#  Date Last Modified:

Use the turnin program to submit your Day.py file. The proctors should receive your work by 11 PM on Friday, 26 September 2012. There will be substantial penalties if you do not adhere to the guidelines. The TA in charge of this assignment is Joseph Perez (jdperez@utexas.edu).