Classes and Member Functions

Hello! As someone very new using C++, I'm having difficulty with object programming. Can someone help me with the program instructions below?

[Member functions

Write a constructor function for your class that has no parameters. The constructor should set the month to 1 (January), the day to 1 and the year to 2001.

Write a "set" member function that allows a new date to be stored in an existing Date object. The function should have 3 integer parameters - one each for the month, day and year. The purpose of these parameter is to provide the values to be stored in the data members of the obbject. The function should do validation checking on the data supplied in the parameters as follows:

The month should be between 1 and 12 (inclusive).
The day should be between 1 and 31 (inclusive).
The year should be between 1950 and 2020 (inclusive).
If one or more of the parameters contains invalid values, do not update any data members of the object. Otherwise, store the information from the parameters into the corresponding data members of the object.
Write three "print" member functions. Each should print a Date in one of the following formats:

March 15, 2010
15 March 2010

Your class should also have a private member function that returns the month name as a string. For example, if the date is 3/15/2010, this function would return the string "March". The function prototype might look like:

string getMonthName( );

Your print functions that need to display a month name should use this function.

Note: As noted in the textbook, generally it is best not to do any input or output in member functions. One exception is when a member function is designed to perform a specific output operation, such as printing an object in a standard format.

Write a main function to test your class. Be sure that your output shows that each of your member functions works. And be sure that you try invalid data as well as valid data.

Other Requirements

Global variables are variables that are declared outside any function. Do not use global variables in your programs. Declare all your variables inside functions.
Use the C++ string class to represent strings in your program.]

How do you want me to help you? I don't see a question or problem you're having.
Topic archived. No new replies allowed.