Project 4
Due Date: beginning of lecture, Tuesday, Oct. 12, 2004
The purpose of this assignment is to become
familiar
with conditional control structures.
Background
A calendar date consists of a month, a day of the month, and a year.
Many
programs must be able to handle dates, so it is useful to understand
how
such things are represented and manipulated.
In this project, we will represent a date as an
ordered
triple of integer values representing the month, day, and year, in that
order. To be a valid date, this triple must have four properties:
- the month must be in the range 1-12, where January = 1 and
December =
12;
- the day must be in the range 1-31;
- the year must be no earlier than 1753, the first full year of our
current
(Gregorian) calendar;
- the month/day/year combination must form a valid date; that is,
- the day can't be 31 in a 30-day month;
- in February, the day can't be greater than 28 (non-leap year)
or 29
(leap
year).
A year is a leap year if it is divisible by 4 but not by 100.
Exceptionally,
a year that's divisible by 400 is a leap year. (ASIDE: one
aspect
of the "Y2K problem" of the year 2000 is that many programs failed to
recognize
this exception, and treated 2000 as a non-leap year!)
Project
Develop a program that will
- prompt the user to enter a month, a day, and a year;
- validate the date according to the properties above;
- display a message indicating whether or not the date is valid.
What to submit:
You must follow the process given in Systematic
Software Development and the sample project packet distributed
in class.
Your grade will be calculated on a 20-point basis, as follows:
- 6 points -- analysis and design (including algorithm in
structured
English)
- 4 points -- test plan
- 6 points -- correct execution of program according to test plan
- 4 points -- layout and style of program source code
Extra credit:
We'll continue the 2-point bonus for getting an early start. If you
e-mail
your "framework" listing file to Prof. Feldman, and the time stamp on
the
e-mail is no later than 5 PM, Friday, Oct. 8, 2004, you will be
awarded
2 extra project points. The "framework" must be a listing (.txt)
file, with no compilation errors or warnings, that contains the
declared
variables, and a set of comments inserted for the main algorithm steps.
MBF 10/3/04