Computer Science 275.001
Interaction Programming
Fall 2006
Visual Basic
Programming Assignment #1
Due: Thursday, August 31, 2006
(Due in drop-box by 1:00 PM)

Your first VB2005 assignment in this course is designed to provide you with some practice with procedures, functions, conditionals, labels, and buttons. The single form in this application will provide a straightforward calendar implementation, displaying a single day at a time and allowing the user to adjust the day, month, and year of the displayed date forwards and backwards via buttons. In addition, the form will display the day of the week for the displayed date, as well as the name of the national holiday being displayed (if the date is a national holiday).The form will have the structure displayed below: Note
that this design involves event handlers for seven buttons: an exit button and
six previous/next buttons for the month, day, and year being displayed. In addition, an adjustment should only affect the time unit that is
associated with a particular button (e.g., adding a day to New Year's Eve takes
the user to December 1 of that same year, subtracting a month from a January
date takes the user to December of that same year). Finally, any of ten national holidays are recognized by this application,
with font colors switched from black to dark red whenever a holiday is displayed.
Required member functions in your
form’s class include:
Event
handlers for loading the form and clicking each of the seven buttons.
A
sub-procedure for updating the date labels (called at the end of each
event handler).
A function
that calculates the name of the current date’s holiday, returning an empty
string if the date is not a holiday.
In
addition, your class should have a data member to store the current date, as
well as arrays storing the names of the months and the names of the days of the
week.

The ten national holidays that you
should implement in your application are:
For
instance, to test for Presidents’ Day, check whether the month is February, and the day of the week is Monday,
and the day of the month
is between 15 and 21. Similarly, to
check for Columbus Day, check whether the month is October, and the day of the week is Monday,
and the day of the month
is between 9 and 15.
The Visual Basic 2005 Date Class
To
facilitate the implementation of this application, use the VB2005 Date class,
which provides much of the functionality that you will require.
'The following
code sets the variable up with the run-time date.
Dim CurrentDate As Date
CurrentDate = Now
'The following
code sets the variable CurrentDay up with the numerical value of
'CurrentDate’s
day (between 1 and the number of days in CurrentDate’s month).
Dim CurrentDay As Integer = CurrentDate.Day
'The following
code sets the variable CurrentMonth up with the
'numerical value
of CurrentDate’s month (between 1 and 12).
Dim CurrentMonth As Integer = CurrentDate.Month
'The following
code sets the variable CurrentYear up
'with the
numerical value of CurrentDate’s year.
Dim CurrentYear As Integer = CurrentDate.Year
'The following
code sets the variable CurrentDayOfWeek up with the numerical value of
'CurrentDate’s
day of the week (0 for Sunday, 1 for Monday, ..., 6 for Saturday).
Dim CurrentDayOfWeek As Integer = CurrentDate.DayOfWeek
CurrentDate = CurrentDate.AddDays(3) 'Advance the
entire date 3 days.
CurrentDate =
CurrentDate.AddDays(-2) 'Move the entire date back 2 days.
CurrentDate =
CurrentDate.AddMonths(1) 'Advance the entire date 1 month.
CurrentDate =
CurrentDate.AddMonths(-5) 'Move the entire date back
5 months.
CurrentDate =
CurrentDate.AddYears(20) 'Advance the entire date 20 years.
CurrentDate =
CurrentDate.AddYears(-4) 'Move the entire date back 4 years.
'The following
code sets the variable CurrentDaysInMonth up with the numerical value
'of the number
of days in CurrentDate’s month, given its month and year values.
Dim CurrentDaysInMonth As Integer = Date.DaysInMonth(CurrentDate.Year, CurrentDate.Month)
Remember that your entire project folder
is due on your drop-box by 1:00 PM on Thursday, August 31, 2006.