Question: Guess the missing C++ code. The main module is essentially a test driver program to exercise a class called CDate. But where does this class

Guess the missing C++ code.

The main module is essentially a test driver program to exercise a class called CDate. But where does this class exist? Well, I'm afraid you're going to have to implement it! You'll need to carefully study the main driver program and observe what the class does in the code, and run the sample executable to confirm your observations. Look at every CDate variable and the functions it's calling, and don't forget - those objects are going to be calling constructors when they're allocated in memory too!

Note that the CDate::SetMonth, CDate::SetDay and CDate::SetYear member functions return boolean values. That's because for this assignment we'll set some arbitrary data validation rules: a month must be a positive value between 1 and 12 (inclusive), a day must be a positive value between 1 and 31 (inclusive), and a year must be a positive four-digit value. So, each of these member functions should validate the data passed in through the formal parameters. If the incoming data is determined to be valid, you can make the assignment to the private data member and return a value of true; else, do not make the assignment and return a value of false. Naturally, since you'll have "Set" functions to set the month, day and year, it only makes sense to provide "Get" functions that allow a caller to get those values as well, right?

This assignment will also give you a chance to experiment with overloading constructors. Look at the main driver program to see how these constructors are invoked. Study the code in main.cpp carefully and compare it with what you see when you run the sample executable.

Guess the missing C++ code. The main module is essentially a test

driver program to exercise a class called CDate. But where does this

class exist? Well, I'm afraid you're going to have to implement it!

You'll need to carefully study the main driver program and observe what

the class does in the code, and run the sample executable to

confirm your observations. Look at every CDate variable and the functions it's

calling, and don't forget - those objects are going to be calling

SAMPLE RUN

constructors when they're allocated in memory too! Note that the CDate::SetMonth, CDate::SetDay

#include # include #include using namespace std: #include "caate.h" const int BUFLEN 2 5 6 ; main int main) // create a default CDate object CDate datel: // display the default date object cout # include #include using namespace std: #include "caate.h" const int BUFLEN 2 5 6 ; main int main) // create a default CDate object CDate datel: // display the default date object cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!