![]() |
School of Engineering and
Applied
Science Department of Computer Science CSci 49 -- Introduction to C Computing http://www.seas.gwu.edu/~csci49/spring06 Prof. Michael B. Feldman mfeldman@gwu.edu |
| These
function do NOT write any output to the console.
int isValid (int month, int day, int year) Returns 1
if month, day,
and year form a
valid
date whose year is no earlier than 1753, and 0
otherwise.
int daysInMonth (int month, int year) Returns the number of days the
month month
has in the year year,
or MAXINT if
either parameter is out of range.
int dayOfWeek(int month, int day, int year) Returns the day of the week
(Sunday = 0,
Monday = 1, etc.) for the given month/day/year combination, if that
combination
forms a valid date, or MAXINT
otherwise.
|
This project is quite different from Projects 1-5. In the others, there was only a single application program, but in this one you are writing a library that provides a set of reusable functions. These functions could be imported into, and used by, any number of different applications.
So how do you test such a thing? Each function must be tested on its own, independently of the others. In effect, each function requires its own little test plan. You can choose to implement each little test plan with a separate test program, or you can write one larger main program that carries out a sequence of little test plans. That choice is up to you, but it must be clear from the test plans, the annotations on your turnin, and your test-program code, how each method is being tested on its own.
int validityFlag = 0;
while(validityFlag == 0)
{
// prompt for oneMonth,
oneDay,
and oneYear
if (isValid(oneMonth,
oneDay, oneYear))
{
validityFlag = 1;
}
else
{
printf ("Invalid date; please try
again.\n");
}
}
Your grade will be calculated on a 20-point basis, as follows:
MBF 3/28/06