|
-
Apr 12th, 2001, 10:04 PM
#1
Alert! Damsel in distress!
I'm having trouble with this someone please help me!
This is the whole project - very confusing - any help?
Perpetual Calendar Project
Introduction
The Gregorian calendar was introduced in 1582. You are being asked to write a program which calculates the day of the week for any date past and future, falling after 12/31/1582 to make a calendar for a specified month and year.
Overview of the Problem
a. Request the month, day, and year as numeric inputs. Use either single or multiple textboxes to capture the user’s inputs. Single text boxes make it necessary to parse the data to separate the month day and year but simplifies the user interface with the program.
b. After you determine the maximum number of days in the month, check the user’s inputs for validity. If you determine an error in the input, notify the user with an error message or frowning face symbol and allow him to correct the errant month, day or year.
The maximum number of days in each month is constant for all months except February, which is usually 28 days except leap years, when February has 29 days.
A year is said to be a leap year if all of the following conditions are met.
Any years divisible by 4 is considered a leap year, with the exception of those years divisible by 100 and not by 400. By this rule, the years 1600 and 2000 are leap years but the years 1700, 1800, and 1900 are not. If you are clever, this leap year condition can be tested with a single “If” statement. See chapter 5 of our textbook for more details on the “If” and the “Select Case”
Algorithm
Use the following algorithm to determine the day of the week for a given date.
1) Treat January and February as the 13th and 14th months of the previous year, respectively. Thus, 1-10-98 is treated as 13-10-1997. Similarly, 2-10-1998 becomes 14-10-1997.
2) Let m, d, and y denote the month, day, and year, respectively. Similarly,
2-10-1998 becomes 14-10-1997. Compute w, where
w = d + 2*m + Int((3/5)*(m +1)) + y + Int(y/4) – Int(y/100) + Int(y/400) + 2
3) The remainder of w divided by 7 denotes the day of the week, where 0 is Saturday, 1 is Sunday, 2 is Monday, and so on. Hint : See the “Mod” function described on page 126 – Comment 8 of our text.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|