Hi guys. Have have this assignment which consists of 7 questions.I manage to finish 6 but i'm stuck on this. I hope you guys would help me out by pointing out what i should do first in this programming. You help is required but i wish to do the code on my own effort. So, i need help and guidelines. I'mstuck because i'm not familiar with ctime.h and with those member functions. Here's the question which i'm stuck.
-------------------------------------------------------------------
Create a Date class with the following capabilities:
a) Output the date in multiple formats such as
June 14, 1992

Use overloaded constructors to create Date objects initialized with dates of the formats in part (a).
c) Create a Date constructor that reads the system date using the standard library functions of the <ctime> header and sets the Date members.
Your Date.h file – class definition, should contain the following codes
// Date2.H
#ifndef Date2_H
#define Date2_H
#include <ctime>
#include <cstring>
class Date {
public:
Date();
Date( char *, int, int );
void setMonth( int );
void setDay( int );
void setYear( int );
void printDateMonth( void ) const;
const char *monthName( void ) const;
bool leapYear( void ) const;
int daysOfMonth( void ) const;
void convert( const char * const );
const char *monthList( int ) const;
int days( int ) const;
private:
int day;
int month;
int year;
};
#endif
Your program should give the following input and output.
July 4, 1998
March 27, 1999
July 26, 2000
September 1, 1998
------------------------------------------------------------------
another question regarding this question.
just for example, can this code be used with the header file given? and are those commands allowed? any feedback would be most helpful.
------------------------------------------------------------------
using std::endl;
#include "Date2.h"
Date::Date( char *year, int month, int day )
{
}
void Date::setMonth(int mn)
{
if (mn > 0 && mn <=12){
month = mn;
}
else {
month = 1;
cout<<"Invalid month"<<"\n"<<endl;
}
}
void Date::setDay(int dy)
{
if(mn = 1 || mn = 3 || mn = 5 || mn = 7 || mn = 8 || mn = 10 || mn = 12)
{
if (dy > 0 && dy <=31){
day = dy;
}
}
if(mn = 4 || mn = 6|| mn = 9 || mn = 11)
{
if (dy > 0 && dy <=30){
day = dy;
}
}
}