Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

IN C++. (hourlyemp.h in the codes is not necessary for the assigment) Step 1: Wr

ID: 3867822 • Letter: I

Question

IN C++. (hourlyemp.h in the codes is not necessary for the assigment)

Step 1: Write a class called Administrator which is to be derived from the class SalariedEmp which is derived from Employee.

Use these files:

employee.h

employee.cpp

salariedEmp.h

salariedEmp.cpp

empTest.cpp

Your Administrator class should have the following additional members:

A data member of type string that contains the administrator's title (such as Director or Vice President).

A data member of type string that contains the company area of responsibility (such as Production, Accounting, or Personnel).

A data member of type string that contains the name of this administrator's immediate supervisor.

A default constructor that initializes ALL of the data members to empty strings, as well as a constructor that allows the client programmer to provide values for ALL of the data members.

A member function called changeSupervisor which changes the supervisor name.

A member function for reading in the administrator's information from the keyboard. The user should be prompted for each piece of information. This should include information to fill in the data members derived from other classes, such as the name of the administrator.

A member function called print which outputs the administrator's data to the screen.

A redefinition of the member function printCheck() with appropriate notations on the check. This function will look a lot like the print member function, except that the output will look like a check. Base this output on the printCheck() function in the base class. The check itself will not change from how it looks in the base class. The check stub, however, should include information such as the administrator's title, area of responsibility, and supervisor.

Explanation / Answer

Base Class Employee have the data members netpay, name and ssn are defined as a private data members.
As per OOPS principles class private data cann't be access outside the class.
But Salaried employee is trying to modify the Employee class data members .
Because of these things your code is giving errors.

But i have written the below code as specified in problem statement
1. Created Admin class with data members
2. Created default and parametrised constructors.
3. Crated the changeSupervisorName function.
4. Define print and printCheck and setAdminstratorInfo methods.

First Please correct the given code and then add this code with exiting code..
then it works fine.

class Administrator : public SalariedEmp
{
    string title;
    string responsibility;
    string immediate_supervisor;
public :
    // Default Constructor
    Administrator()
    {
        title = " ";
        responsibility = " ";
        immediate_supervisor = " ";
    }
    // Parametrised Constructor
    Administrator(string ti, string res, string imme)
    {
        title = ti;
        responsibility = res;
        immediate_supervisor = imme;
    }
  
    // This function will change the name of the immediate_supervisor name
    void changeSupervisorName(string name)
    {
        immediate_supervisor = name;
    }
    // Set the name of the Administrator by passing information to Base class name of the employee with
    // help of salariedEmp constructor
    void setAdminstratorInfo(string newName): salariedEmp(newName)
    {
    }
  
    // print the Administrator information
    void print()
    {
        cout<<"Administrator Title :"<<title<<endl;
        cout<<"Administrator Responsibility :"<<responsibility<<endl;
        cout<<"Administrator Immediate Supervisor :"<<immediate_supervisor<<endl;
    }
  
    // Redefine the Employee printCheck method from SalariedEmp class
    void printCheck()
    {
        cout << "Name " << name << endl;
        cout << "the sum of " << netPay << " Dollars." << endl;  
        cout << "Check Stub: " <<"Administrator Title "<< title <<"Administrator Responsibility "
             <<responsibility << "Administrator Immediate Supervisor "<< immediate_supervisor<<sendl;
        cout << "Employee number: " << ssn << endl;
        cout << "This is a salaried employee. Regular pay: " << salary << endl;
    }
  
};