Calendar (Due 01 Mar 2013)

In this program you will prompt the user to enter the month and year. Your program will print out the calendar for that month and year.

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 until the input is in the correct range.

Once you have the correct month and year you will use Rev. Zeller's algorithm to find out what day of the week the first of the month was for that year.

In Rev. Zeller's algorithm the following terms a, b, c, and d are defined as follows:

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, where r = 0 represents Sunday, r = 1 represents Monday, and so on.

Here is a possible Input / Output scenario:

Enter Month (1 - 12): 15

Enter Month (1 - 12): 2

Enter Year (1900 - 2100): 1850

Enter Year (1900 - 2100): 2012

Feb             2012
Su Mo Tu We Th Fr Sa
          1  2  3  4
 5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29

Assume that the user only enters integers that can be stored in an int. Here is the order of operation:

Here are the constraints on the output:

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



  Student Name:

  Student UT EID:

  Course Name: CS 312

  Unique Number: 

  Date Created:

  Date Last Modified:


You will follow the standard Java Coding Conventions. You can either view the HTML page or download the PDF or Postscript and print it out. There is a modification that I would like to make to the standard coding conventions. Please align the opening and closing braces vertically so that you can easily make out the blocks of code. For example:

Do this:
if ( x > 5 )
  a = b + c;

Not this:
if ( x > 5 ) {
  a = b + c;

Use the turnin program to submit your .java file. We should receive your work by 11 PM on Friday 01 Mar 2013. There will be substantial penalties if you do not adhere to the guidelines.