Below is a copy of my code but the two error messages are:
1. base class 'Employee' has an incomplete type
2. parse error at input
Plus having trouble figuring out error messages which can't move on until I do.
Here are the requirements - design a base class name Employee and have it keep the following info in member variables:
Employee name
Social Sec # format xxx-xx-xxxx with each digit in 0-9 range
employee number in format of xxx-L with L in range of A-M
Hire date.
add a const. and dest. and other member functions to class. const. should allocate enough memory to hold name.
Next add new class named EmployeePay derived from Employee class with following variables - Annual Pay, Monthly Pay Dependents.
Please help. Even getting solving the current error messages will help me get on with it.
Thanks to all.
#include <iostream.h>
#include <stdlib.h>
#include <string.h>
#include <iomanip.h>
class Employee
{
protected:
char EmployeeName;
char SSNum[12];
char EmpNum[6];
int HireDate;
public:
Employee(void) { EmployeeName = new name[25]; }
~Employee(void) { delete [] EmployeeName;}
void setName(char n)
{ strcpy(name, n); }
void setSSNum(char i)
{ strcpy(SSNum, i); }
void setEmpNum(char e)
{ strcpy(EmpNum, e); }
void setHireDate(int h) { HireDate = h; }
float getName(void) { return name[]; }
float getSSNum(void) { return SSNum[]; }
float getEmpNum(void) { return EmpNum[]; }
int getHireDate(void) { return HireDate
};
class EmployeePay : public Employee
{
private:
float AnnualPay;
float MonthlyPay;
int Dependents;
public:
EmployeePay(float, float, int);
void setAnnualPay(float p) { AnnualPay = p; }
void setMonthlyPay(float m) { MonthlyPay = m; }
int setDependents(int d) { Dependents = d; }
float getAnnualPay(void) { return AnnualPay; }
float getMonthlyPay(void) { return MonthlyPay; }
int getDependents(void) { return Dependents; }
};
//EmployeePay::EmployeePay(float AnnualPay, float MonthlyPay, int Dependents) : Employee(name, SSNum, EmpNum, HireDate)
//{
//}
void main(void)
{
Employee PerInfo;
EmployeePay PayInfo;
cout << "Enter the Name: ";
cin >> name;
cout "Enter Social Security Number ( in the format xxx-xx-xxxx, where x is a number); "
cin >> SSNum;
cout << "Enter Employee Number (in the format XXX-l, where x is a number";
cout << " \t and L is a letter between A-M): "
cin >> EmpNum;
cout << "Enter Hire date: ";
cin >> HireDate;
cout << "Enter annual pay: ";
cin >> AnnualPay;
cout << "Enter monthly pay: ";
cin >> MonthlyPay;
cout << "Enter number of dependencies: ";
cin >> Dependents;
cout << endl;
cin.getline(name, 25);
PerInfo.setName(name);
cin.getline(SSNum, 12);
PerInfo.setSSNum(SSNum);
PerInfo.setEmpNum(EmpNum);
cin.getline(HireDate, 9);
PerInfo.setHireDate(HireDate);
PayInfo.setAnnualPay(AnnualPay);
PayInfo.setMonthlyPay(MonthlyPay);
PayInfo.setDependents(Dependents);
cout << "Name: " << PerInfo.getName();
cout << "Social Security Number: " << PerInfo.getSSNum();
cout << "Employee #: " << PerInfo.getEmpNum();
cout << "Hire Date: " << PerInfo.getHireDate();
cout << "Annual Pay: " << PayInfo.getAnnualPay();
cout << "Monthly Pay: " << PayInfo.getMonthlyPay();
cout << "# of Dependents: " << PayInfo.getMonthlyPay();
coun << endl;
system("PAUSE");
}