Program / Task Name:

   Create a Monthly Planner

Level:

 

 Advanced

Point Value:

 

 11

 

Task Description

You’ve been tasked with creating a calendar for a particular month of the year.  You will also create a calendar for the previous month and the next month.

Program Input

Your program will prompt the user for:

  • the number of the month, where 1=January, 2=February, 3=March, 4=April, 5=May, 6=June, 7=July, 8=August, 9=September, 10=October, 11=November, and 12=December
  • the day of the week on which the month begins, where 1=Sunday, 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday, 7=Saturday

You can assume:

  • the year in question IS NOT a leap year,

  • only valid values (for the month and day) will be entered, and

  • the months of January and December will not be entered as the month (values 1 and 12)

Enter the number of the month for the calendar: 3
Enter the day on which the month begins: 7

Program Output

Your program must display a 3 month calendar containing the month specified, the previous month, and the next month as follows:

February                March                   April
Su  M Tu  W Th  F Sa    Su  M Tu  W Th  F Sa    Su  M Tu  W Th  F Sa
                   1                       1           1  2  3  4  5
 2  3  4  5  6  7  8     2  3  4  5  6  7  8     6  7  8  9 10 11 12
 9 10 11 12 13 14 15     9 10 11 12 13 14 15    13 14 15 16 17 18 19
16 17 18 19 20 21 22    16 17 18 19 20 21 22    20 21 22 23 24 25 26
23 24 25 26 27 28       23 24 25 26 27 28 29    27 28 29 30
                        30 31

 

 

   
  (c) 2004 Hewlett-Packard Company