|
|
|
|
|
|
|
//******************************************************************
long TimeCard::IDPart() const
// Postcondition:
// Function value == id
{
return id;
}
//******************************************************************
Time TimeCard::TimePart() const
// Postcondition:
// Function value == timeStamp
{
return timeStamp;
}
//******************************************************************
void TimeCard::Print() const
// Postcondition:
// Time card has been output in the form
// ID: 235658 Time: 08:14:25
{
cout << ID: < id < Time: ;
timeStamp.Write();
} |
|
|
|
|
|
|
|
|
Testing: These functions are all very easy to test. Because the Time class has already been tested and debugged, the Punch function (which calls Time::Set) and the Print function (which calls Time::Write) should work correctly. Also, none of the TimeCard member functions use loops or branching, so it is sufficient to write a single test driver that calls each of the member functions, supplying parameter values that satisfy the preconditions. |
|
|
|
|
|
|
|
|
The Time Card List Object: This object represents a list of time cards. Once again, we'll have to write a new C++ class for this list because no builtin type or existing class will do. |
|
|
|
|
|