How to pass variables to a class
<p>I have been working on this code for quite some time now and I had posted it before but then after fixing that problem another problem arose so I created a new post with the name of this problem. Ok the problem is that I am obviously not passing the variables to the Administrator class the right way. I have tried two ways which is all my book shows and both have given me an error that says error C2512: 'SalariedEmployee' : no appropriate default constructor available". I have tried </p>

<pre><code>  //Lynette Wilkins
//Week 12

#include &lt;iostream&gt;
#include &lt;cstdlib&gt;
#include &lt;string&gt;
#include &lt;iomanip&gt;
#include &lt;cmath&gt;

using namespace std;

class SalariedEmployee
{
private:
    double wageRate;
    int hours;
protected:
    string name;
    string ssn;
    double netPay;
    string department;

public:
    SalariedEmployee(string n, string s, double np, double w, int h, string d);
     ~SalariedEmployee() {cout&lt;&lt;endl;}
     string Getname();  //returns name
     string Getssn();   // returns social security number
     double GetnetPay(); //returns netPay
     string Getdepartment(); // returns department
     double GetwageRate(); //returns wage rate
     int Gethours(); //returns hours
     void Setname(string); //sets name
     void Setssn(string); //sets ssn
     void SetnetPay(double); //sets net pay
     void Setdepartment(string); //sets department
     void SetwageRate(double); //sets wage rate
     void Sethours(int); //sets hours

};

SalariedEmployee::SalariedEmployee(string n, string s, double np, double w, int h, string d) : name(n),
      ssn(s),
      netPay(np),
      wageRate(w),
      hours(h),
      department(d)
{}


string SalariedEmployee::Getname()
{
    return name;
}

string SalariedEmployee::Getssn()
{
    return ssn;
}

double SalariedEmployee::GetnetPay()
{
    return netPay;
}

double SalariedEmployee::GetwageRate()
{
    return wageRate;
}

int SalariedEmployee::Gethours()
{
    return hours;
}
void SalariedEmployee::Setname(string n)
{
    name = n;

}

void SalariedEmployee::Setssn(string s)
{
    ssn = s;
}

void SalariedEmployee::SetnetPay(double np)
{
    netPay = np;
}

void SalariedEmployee::Setdepartment(string d)
{
    department = d;
}


void SalariedEmployee::SetwageRate(double w)
{
    wageRate = w;
}

void SalariedEmployee::Sethours(int h)
{
    hours = h;
}


class Administrator : public SalariedEmployee
{
protected:
    string title;
    string responsi;
    string super;
    double salary;
public:
    Administrator(string t, string r, string s, double sa);
     ~Administrator();
    string Gettitle();
    string Getresponsi();
    string Getsuper();
    double Getsalary();
    void Settitle(string);
    void Setresponsi(string);
    void Setsuper(string);
    void Setsalary(double);
    void print();
};


Administrator::Administrator(string t, string r, string s, double sa) :  title(t), responsi(r), super(s), salary(sa)
{
}

Administrator::~Administrator()
{
    cout&lt;&lt;endl;
}

string Administrator::Gettitle()
{
    return title;
}

string Administrator::Getresponsi()
{
    return responsi;
}

string Administrator::Getsuper()
{
    return super;
}

double Administrator::Getsalary()
{
    return salary;
}
void Administrator::Settitle(string ti)
{
    title = ti;
}
void Administrator::Setresponsi(string re)
{
    responsi = re;
}


void Administrator::Setsuper(string su)
{
    super=su;
}

void Administrator::Setsalary(double sa)
{
    salary= sa;
}

void Administrator::print( )
  {

    cout &lt;&lt; "\n_______________________________________________\n";

    cout &lt;&lt; "Pay to the order of " &lt;&lt; name&lt;&lt; endl;
    cout &lt;&lt; "The sum of " &lt;&lt; netPay &lt;&lt; " Dollars\n";
    cout &lt;&lt; "_________________________________________________\n";
    cout &lt;&lt;endl&lt;&lt;endl;
    cout &lt;&lt; "Employee Number: " &lt;&lt; ssn &lt;&lt; endl;
    cout &lt;&lt; "Salaried Employee. Regular Pay: " 
       &lt;&lt; salary &lt;&lt; endl; 
    cout &lt;&lt; "_________________________________________________\n";
  }





int main()
{


    string name;
    string soc;
    double net = 0;
    double wage = 0;
    int hrs = 0;
    string dept;
    string admtitle;
    string resp;
    string sup;
    double sal = 0;
    int response = 0;

    string date = "January 12, 2013";


    cout&lt;&lt;setprecision(2)
    &lt;&lt;setiosflags(ios::fixed)
    &lt;&lt;setiosflags(ios::showpoint);

    SalariedEmployee emp1(name, soc,net, wage, hrs, dept);
    Administrator adm1(admtitle, resp, sup, sal);


while(response != 4){

    cout&lt;&lt;"Employee and Administrator Salary Program "&lt;&lt;endl;
    cout&lt;&lt;"(You will have to enter data first before you do anything else)"&lt;&lt;endl&lt;&lt;endl;
    cout&lt;&lt;"Enter Employee Data,  Enter 1"&lt;&lt;endl;
    cout&lt;&lt;"Change data,   Enter 2"&lt;&lt;endl;
    cout&lt;&lt;"Print Check,   Enter 3"&lt;&lt;endl;
    cout&lt;&lt;"End Program, Enter 4"&lt;&lt;endl&lt;&lt;endl;
    cout&lt;&lt;"Please make your selection"&lt;&lt;endl;



cin&gt;&gt; response;

    switch (response)


    {
    case 1:
        cout &lt;&lt;"The employee's data will be entered here: "&lt;&lt;endl&lt;&lt;endl;

        cout&lt;&lt;"Enter the employees name: ";
        cin.ignore();
        getline(cin, name);

        cout&lt;&lt;"Enter the employees social security number: ";
         cin.ignore();
        getline(cin, soc);

        cout&lt;&lt;"Enter the employees net pay: ";
        cin&gt;&gt;net;

        cout&lt;&lt;"Enter the employees wage rate: ";
        cin&gt;&gt;wage;

        cout&lt;&lt;"Enter the number of hours the employer worked: ";
        cin&gt;&gt;hrs;

        cout&lt;&lt;"Enter the employees title: ";
        cin.ignore();
        getline(cin,admtitle);

        cout&lt;&lt;"Enter the employees area responsibility: ";
        cin.ignore();
        getline(cin, resp);

        cout&lt;&lt;"Enter the employees salary: ";
        cin&gt;&gt;sal;



        cout&lt;&lt;endl&lt;&lt;endl&lt;&lt;endl;


        break;




    case 2:

        cout&lt;&lt;"Please change the data you entered previously here. " &lt;&lt;endl&lt;&lt;endl;

        cout&lt;&lt;"Enter the employees name: ";
        cin.ignore();
        getline(cin, name);

        cout&lt;&lt;"Enter the employees social security number: ";
         cin.ignore();
        getline(cin, soc);

        cout&lt;&lt;"Enter the employees net pay: ";
        cin&gt;&gt;net;

        cout&lt;&lt;"Enter the employees wage rate: ";
        cin&gt;&gt;wage;

        cout&lt;&lt;"Enter the number of hours the employer worked: ";
        cin&gt;&gt;hrs;

        cout&lt;&lt;"Enter the employees title: ";
        cin.ignore();
        getline(cin,admtitle);

        cout&lt;&lt;"Enter the employees area responsibility: ";
        cin.ignore();
        getline(cin, resp);

        cout&lt;&lt;"Enter the employees salary: ";
        cin&gt;&gt;sal;



        cout&lt;&lt;endl&lt;&lt;endl&lt;&lt;endl;
break;



    case 3:

        cout &lt;&lt;"Information Printed"&lt;&lt;endl&lt;&lt;endl;

        cout&lt;&lt;"_____________________________"&lt;&lt;date&lt;&lt;endl;
        &amp;Administrator::print;



        break;


    default:

        cout&lt;&lt;endl&lt;&lt;endl
            &lt;&lt;"Invalid Selection! Try Again"&lt;&lt;endl;
        exit(1);

}
}





    system("PAUSE");
    return 0;
}
</code></pre>
