Can't figure out compiler message so I can move on

This is a discussion on Can't figure out compiler message so I can move on within the C++ Programming forums, part of the General Programming Boards category; Below is a copy of my code but the two error messages are: 1. base class 'Employee' has an incomplete ...

  1. #1
    Unregistered
    Guest

    Unhappy Can't figure out compiler message so I can move on

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

  2. #2
    Registered User Azuth's Avatar
    Join Date
    Feb 2002
    Posts
    236
    int getHireDate(void) { return HireDate

    The at the end of that line suggests you have a ")" instead of a "}". That could be an issue.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strange string behavior
    By jcafaro10 in forum C Programming
    Replies: 2
    Last Post: 04-07-2009, 07:38 PM
  2. Problem in message handling VC++
    By 02mca31 in forum Windows Programming
    Replies: 5
    Last Post: 01-16-2009, 08:22 PM
  3. socket message sending and receiving problem
    By black in forum C Programming
    Replies: 5
    Last Post: 01-15-2007, 03:46 AM
  4. input/output
    By dogbert234 in forum Windows Programming
    Replies: 11
    Last Post: 01-26-2005, 05:57 AM
  5. Replies: 5
    Last Post: 09-08-2001, 09:18 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21