Good evening all, I am now working on a project for my intro c++ course and I'm having alot of difficulty understanding how to make a class program. I've been looking over the text but I am still confused. I would really appreciate any suggestions, ideas , or ways to get the program working. Here is the question:
Design a class called Date. The class should store a date in three integers: month, day, and year. There should be member functions to print the date in the following forms:
3/29/04
March 29, 2004
29 March 2004
Use a private member function to set the month name based on the month number. Demonstrate the class by writing a complete program implementing it.
Input Validation: Do not accept values for the day greater than 31 or less than 1. Do not accept values for the month greater than 12 or less than 1.
#include <iostream>
using namespace std;
// Class declaration
class date
{
private:
int monthName;
public:
int month;
int days;
int year;
};
That is all I could manage to do.. for "Use a private member function to set the month name based on the month number"
am I going to use if>else statements for every single month from 01=Jan to 12=dec , etc?
I am really confused about how to proceed in this program so any help is really appreciated. Thank you.
wangsta.