Code Trax by Wax

Programming Diploma in Assembler, Fortran, Basic
C++, JavaScript,HTML, Visual Basic 6.0
//Michael Wetherwax
//Date Class implementaion – C++
#include
#include
#include
#include
#include
#include
#include “Date.h”
#include”Person.h”
const int Date::monthDays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
Date::Date() //:month(0),day(0),year(0) {}
Date::~Date() {}
void Date::getDate()
{
Date tday;
char buffer3[3];
char buffer4[3];
char buffer5[5];
int answer = 0;
// int mo, da, yr, thisyear; do { cout<<"\nEnter month number : "; cin< thisyear));
}
int Date::isValidbmoDigit(char numb[] )
{
int digit3 = 0;
int nondigit3 = 0;
for (unsigned j = 0; j < strlen(numb); j++) { if (isdigit(numb[j])) digit3++; if (! isdigit(numb[j])) nondigit3++; } if ((nondigit3 > 0)||(digit3 >2))
{
cout<<"Month must be no more than 2 numbers. Enter again!\n"; return 0; } else return 1; } int Date::isValidbdayDigit(char numb[] ) { int digit4 = 0; int nondigit4 = 0; for (unsigned j = 0; j < strlen(numb); j++) { if (isdigit(numb[j])) digit4++; if (! isdigit(numb[j])) nondigit4++; } if ((nondigit4 > 0)||(digit4 > 2))
{
cout<<"Day must be no more than 2 . Enter again!\n"; return 0; } else return 1; } int Date::isValidbyearDigit(char numb[] ) { int digit5 = 0; int nondigit5 = 0; for (unsigned j = 0; j < strlen(numb); j++) { if (isdigit(numb[j])) digit5++; if (! isdigit(numb[j])) nondigit5++; } if ((nondigit5 > 0)||(digit5 != 4))
{ cout<<"Year must be 4 numbers. Enter again!\n"; return 0; } else return 1; } void Date::printDate() { cout < tm_mon;
tptr-> tm_mday;
tptr-> tm_year;
today.month = (*tptr).tm_mon + 1;
today.day = (*tptr).tm_mday;

today.year = (*tptr).tm_year + 1900;
//border(‘*’, 60, 1);
//cout<<"\nToday is : "< tm_mon;
tptr-> tm_mday;
tptr-> tm_year;
today2.month = (*tptr).tm_mon + 1;
today2.day = (*tptr).tm_mday;
today2.year = (*tptr).tm_year + 1900;
border(‘*’, 60, 1);
cout<<"\nToday is : "<= 365)
{
yr++;
diff-65;
}
while (diff > 28)
{
mon++;
diff -= monthDays[i];
i++;
}
result.year = yr;
result.month = mon;
result.day = diff;
return result;
}
int Date::operator> (Date d1)
{
int x1, x2;
x1 = (year * 365) + getmonthDays() + day;
x2 = (d1.year * 365) + d1.getmonthDays() + d1.day;
if (x1 > x2)
return 1;
else
return 0;
}
int Date::operator==(Date d1)
{
if((year == d1.year) && (month == d1.month) && (day == d1.day))
return 1;
else
return 0;
}
void Date::operator = (Date d1)
{
month = d1.month;
day = d1.day;
year = d1.year;
}
int Date::getmonthDays(){
int total = 0;
for(int i = 0; i < month -1; i++) total += monthDays[i]; if(((year % 400) == 0) || ((year % 100 ) && (year % 4 == 0))) total = total + 1; return total;