![]() |
School of Engineering and
Applied
Science Department of Computer Science CSci 53 -- Introduction to Software Development http://www.seas.gwu.edu/~csci53/fall05 Prof. Michael B. Feldman mfeldman@gwu.edu |
| All
these methods are public
static;
none of them write any output to the console.
boolean isValid (int aMonth, int aDay, int aYear) Returns true
if aMonth, aDay,
and aYear form a
valid
date whose year is no earlier than 1753, and false
otherwise.
int daysInMonth (int aMonth, int aYear) Returns the number of days the
month aMonth
has in the year aYear,
or Integer.MIN_VALUE if
either parameter is out of range.
int dayOfWeek(int aMonth, int aDay, int aYear) 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 Integer.MIN_VALUE
otherwise.
String monthName (int aMonth) Returns the name of the given
month (1
= "January", etc.),
if aMonth
is the 1-12 range, and the string "BAD
VALUE" otherwise.
String dayName (int aDayOfTheWeek) Returns the name of the given day
(0 = "Sunday",
etc.) if aDay is in
the 0-6 range, and the string "BAD
VALUE" otherwise.
|
This project is quite different from Projects 1-6. In the others, there was only a single application program, but in this one you are writing a class that provides a set of reusable methods. These methods could be imported into, and used by, any number of different applications.
So how do you test such a thing? Each method must be tested on its
own,
independently of the others. In effect, each method 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 method 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.
What's a "framework" for a reusable class? It consists of a stub
for each one of the methods. A stub is a method whose body is either
empty (if it's a void method) or contains a single return
statement that returns one constant value (if it's a value-returning
mathod). For example, here's a stub:
int daysInMonth (int
aMonth,
int aYear)
{
return 28;
}
As with the other frameworks, a framework for a reusable class
must be compilable!
Your grade will be calculated on a 20-point basis, as follows:
MBF 11/7/05