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

Write a program that uses the class SalariedEmployee. Your program is to define

ID: 3661392 • Letter: W

Question

Write a program that uses the class SalariedEmployee. Your program is to define a derived class called Administrator, which is to be derived from SalariedEmployee. You are to supply the following data and function members in the Administrator class: • A member variable of type string that contains the administrator’s title (e.g., Director, Vice President) • A member variable of type string that contains the company area of responsibility (e.g., Production, Accounting) • A member variable of type string that contains the name of this administrator’s immediate supervisor • A protected member variable of type double that holds the administrator’s annual salary (if the salary is for an administrator, the salary is kept in this variable, not the salary variable in the SalariedEmployee class) • A member function that returns each of the variables above • A member function which sets each of the variables above • A member function called print, which outputs the object’s data to the screen The SalariedEmployee class is to contain the following: • Member variables containing the following data: name, ssn, netPay, wageRate, hours, department (the variables wageRate and hours are to be set to private) • A member function that returns each of the variables above • A member function which sets each of the variables above Write a program which instantiates employees and administrators (at least 5 employees and 2 administrators). Write a user interface with a menu to make it easy for the user to enter data into the objects. Then, once the data is entered, give the user options to change any data for an employee or administrator; and to print an employee’s check with the information that was input (name, ssn, netPay, hours, wageRate, hours worked), along with the current date.

Explanation / Answer

//administrator.h
#ifndef ADMINISTRATOR_H
#define ADMINISTRATOR_H

#include <iostream>

#include "salariedemployee.h"

using std::string;

namespace SavitchEmployees
{
class Administrator : public SalariedEmployee
{
public:
Administrator();
Administrator(string theName, string theSsn, double salary);
void inputAdminData();
void outputAdminData();
void printCheck();
private:
string adminTitle;//administrator's title
string workingArea;//area of responsibility
string supervisorName;//immediate supervisor
};
}

#endif // ADMINISTRATOR_H_INCLUDED


//administrator.cpp
#include <iostream>
#include <string>

#include "administrator.h"

using std::string;
using std::cin;
using std::cout;

namespace SavitchEmployees
{
Administrator::Administrator( ):Employee(), salary(0)
{
//deliberately empty
}

Administrator::Administrator(string theName, string theSsn, double theAnnualSalary)
:Employee(theName, theSsn),salary(theAnnualSalary)
{
//deliberately empty
}

void Administrator::inputAdminData()
{
cout << " Enter the details of the administrator " << getname() << endl;
cout << " Enter the admin title" << endl;
getline(cin, adminTitle);
cout << " Enter the area of responsibility " << endl;
getline(cin, workingArea);
cout << " Enter the immediate supervisor's name " << endl;
getline(cin, supervisorName);
}

void Administrator::outputAdminData()
{
cout << "Name: " << getname() << endl;
cout << "Title: " << adminTitle << endl;
cout << "Area of responsibility: " << workingArea << endl;
cout << "Immediate supervisor: " << supervisorName << endl;
}

void Administrator::printCheck()
{
setNetPay(salary);
cout << " ___________________________________ "
cout << "Pay to the order of " << getName() << endl
cout << "The sum of" << getNetPay() << "Dollars "
cout << "______________________________________ "
<< "Check Stub Not negotiable "
cout << "Employee Number: " << getSsn() << endl
cout << "Salaried Employee(Administrator). Regular Pay: "
<< salary << endl
cout << "______________________________________ ";
}
}//SavitchEmployees

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote