Thread: Can't figure out compiler message please help

  1. #1
    Unregistered
    Guest

    Unhappy Can't figure out compiler message please help

    Please help. The two error messages are 1. base class 'Employee' has incomplete type and 2. Parse error at end of input. below is the code. Must enter the info and then it prints out what you entered using a base class and a derived class.

    Please help with other parts if you see any miss direction and send me in the right direction.

    Thanks so much.


    #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");
    }

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    52
    Relook your class Employee definition.

    Example:
    >>char EmployeeName;
    and
    >>float getName(void) { return name[]; }

    If I were a compiler I'd be confused too.
    Is EmployeeName a char or a char [] or char *?
    Is name[] a float?

    Clean up your class declarations and prototypes, recompile and let us know what happened.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Architecture Question
    By Orborde in forum C++ Programming
    Replies: 1
    Last Post: 06-01-2005, 08:05 AM
  2. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  3. Compiler Design... Anyone That Can Help!
    By ComputerNerd888 in forum C++ Programming
    Replies: 3
    Last Post: 09-27-2003, 09:48 AM
  4. I can't figure out this compiler error
    By lime in forum C Programming
    Replies: 7
    Last Post: 07-25-2003, 05:09 PM