I need help with my program

this is the program code

// main.cpp

#include <iostream>
#include <iomanip>
#include "facultyType.h"
using namespace std;

int main()
{
cout<<fixed<<showpoint<<setprecision(2);

facultyType f1;
cout << "The following is the information in the facultyType object - f1:" << endl;
f1.print();
cout << endl;

f1.setSSN(299085146);
f1.setName("Xusheng", "Wang");
f1.setBirthDate(9, 2, 1970);
f1.setSalary(56789.23);
f1.setFullTime(true);
cout << "The following is the information in the facultyType object - f1:" << endl;
f1.print();
cout << endl;

nameType aName("Paul", "Cook");
dateType aDate(8, 12, 1981);
facultyType f2(189325619, aName, aDate, 38000.0, false);
cout << "The following is the information in the facultyType object - f2:" << endl;
f2.print();
cout << endl;

// change f2's name to "David Freeman", birth date to 02/29/1980, and full time to true
// and call .print() method to print the information in f2 again.

f2.setSSN(189325619);
f2.setName("David", "Freeman");
f2.setBirthDate( 02, 29, 1980);
f2.setSalary(38000.0);
f2.setFullTime(true);
cout << "The following is the information in the facultyType object - f2:" << endl;
f2.print();
cout << endl;

facultyType f3;

f3.setSSN(178336517);
f3.setName("Jame", "Thomas");
f3.setBirthDate( 06, 11, 1978);
f3.setSalary(35600.0);
f3.setFullTime(false);

cout << "The following is the information in the facultyType object - f3:" << endl;
cout << "SSN: " << f3.SSN << endl;
cout << "Name: " << &f3.name << endl;
cout << "Birth Date: " << &f3.birthDate<< endl;
cout << "Salary: " << f3.salary << endl;
cout << "Status: " << f3.fullTime<< endl;

system("PAUSE");
return 0;
}

*****

//dataType.cpp

#include <iostream>
#include "dateType.h"
using namespace std;

void dateType::setDate(int mm, int dd, int yy)
{
year = yy; // set year
if (mm >= 1 && mm <= 12)
month = mm; // set month
else
month = 1;
if ((month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12)
&& dd >= 1 && dd <= 31)
day = dd; // set day
else if ((month==4 || month==6 || month==9 || month==11) && dd >= 1 && dd <= 30)
day = dd;
else if (month==2 && year%4==0 && dd>=1 && dd<=29)
day = dd;
else if (month==2 && year%4!=0 && dd>=1 && dd<=28)
day = dd;
else
day = 1;
}

int dateType::getYear() const
{
return year;
}

int dateType::getMonth() const
{
return month;
}

int dateType::getDay() const
{
return day;
}

void dateType::print() const
{
cout << "Birth Date: ";
if (month < 10) cout << "0";
cout << month << "/";
if (day < 10) cout << "0";
cout << day << "/" << year << endl;
}

dateType::dateType(int mm, int dd, int yy)
{
setDate(mm, dd, yy);

***
//dataType.h

#ifndef H_dateType
#define H_dateType

#include <string>
using namespace std;

class dateType
{
public:
void setDate(int, int, int);
int getYear() const;
int getMonth() const;
int getDay() const;
void print() const;
dateType();
dateType(int mm=1, int dd=1, int yy=2000);
int month;
int day;
int year;
};
#endif
*************
//facultyType.cpp

#include <iostream>
#include <string>
#include <cstring>
#include "facultyType.h"
using namespace std;

// add your implementation code for facultyType below
void facultyType::setSalary(double sl)
{
salary = sl;
}
double facultyType::getSalary() const
return salary;
}

void facultyType::setFullTime(bool ft)
{
fullTime = ft;
}

bool facultyType::getFullTime() const
{
return fullTime;

}

void facultyType::print() const
{
cout << "Salary: " << salary << endl;

if (fullTime)
cout << "Status: Fulltime" << endl;
else
cout << "Status: Parttime" << endl;
cout << endl;

}

facultyType::facultyType()
{
salary = 0.0;
fullTime = false;

}

facultyType::facultyType(long ssn, nameType& nm, dateType& bd, double sl, bool ft)
{
SSN = ssn;
salary = sl;
fullTime = ft;

}
facultyType::facultyType(long ssn, char fn[], char ln[], int dd, int mm, int yy, double sl, bool ft)

{
dateType(mm, dd, yy);
salary = sl;
fullTime = ft;
}
*****
//facultyType.h
#ifndef H_facultyType
#define H_facultyType

#include "nameType.h"
#include "dateType.h"
#include "personType.h"

class facultyType : public personType
{
public:
void setSalary(double sl);
double getSalary() const;
void setFullTime(bool);
bool getFullTime() const;
void print() const;
facultyType();
facultyType(long, nameType&, dateType&, double, bool);
facultyType(long, char [], char [], int, int, int, double, bool);

private:
double salary;
bool fullTime;
};
#endif

**************
//nameType.cpp

#include <iostream>
#include <cstring>
#include "nameType.h"
using namespace std;

void nameType::setName(char first[], char last[])
{
strcpy(firstName, first); // set the first name
strcpy(lastName, last); // set the last name
}

void nameType::getName(char first[], char last[]) const
{
strcpy(first, firstName); // get the first name
strcpy(last, lastName); // get the last name
}
void nameType::print() const // print the name
{
cout << "Name: " << firstName << " " << lastName << endl;
}

nameType::nameType() // default constructor
{
firstName[0] = '\0'; // set the first name to null string
lastName[0] = '\0'; // set the second name to null string
}

nameType::nameType(char first[], char last[]) // a constructor
{
setName(first, last); // set the name
}
*****
//nameType.h
#ifndef H_nameType
#define H_nameType

class nameType
{
public:
void setName(char [], char []); // set the full name
void getName(char [], char []) const; // get the full name
void print() const; // print the name
nameType(); // default constructor
nameType(char [], char []); // a constructor with parameters
private:
char firstName[30]; // store the first name
char lastName[30]; // store the last name
};
#endif
****
//personType.cpp
#include <iostream>
#include "personType.h"
#include <cstring>
#include "nameType.h"
#include "dateType.h"

using namespace std;

// Add your implement code for personType below
void personType::setSSN(long ssn)// set the SSN
{
SSN = ssn;
}
long personType::getSSN(long& s) const// get the SSN
{
return SSN;
}

void personType::setName(char first [], char last[]) // set the name
{
}
void personType::setName(nameType&) // set the name
{}
nameType getName()
{}
void personType::setBirthDate(int m, int d, int y) // set the birthDate
{}
void personType::setBirthDate(dateType&) // set the birthDate
{}
dateType getBirthDate()
{}
void personType::print() const
{
cout << "SSN: " << SSN << endl;
cout << "Name: " << &name << endl;
cout << "Birth Date: " << &birthDate << endl;

}

personType::personType() // default constructor
{}
personType::personType(long, nameType&, dateType&)

{}
personType::personType(long, char [], char [], int, int, int)
{}


**************
//personType.h

#ifndef H_personType
#define H_personType

#include "nameType.h"
#include "dateType.h"

class personType
{
public:
void setSSN(long ssn);

long getSSN(long& ) const; // get the SSN
void setName(char first [], char last[]); // set the name
void setName(nameType&); // set the name
nameType getName() const;
void setBirthDate(int m, int d, int y);
void setBirthDate(dateType&);
dateType getBirthDate() const;
void print() const;
personType(); // default constructor
personType(long, nameType&, dateType&);

personType(long, char [], char [], int, int, int);

protected:
long SSN;
nameType name; // store person's full name
dateType birthDate; // store person's birthDate
};
#endif
And? You haven't asked a question, told us what your problem is, or even given us the slightest indication of what you're trying to achieve. What are we supposed to do with this post?

And if you're going to post code, please use code tags to make it readable:

http://www.cplusplus.com/articles/z13hAqkS/
Last edited on
I need help with my program

this is the program code

If you read this somewhere, where would you think you'd start?
Topic archived. No new replies allowed.