Question: #include #include using namespace std; class employee { private:int age; int id; float salary; string jobTitle; float timeOnJob; public: employee() { age = 0; id
#include
#include
using namespace std;
class employee {
private:int age;
int id;
float salary;
string jobTitle;
float timeOnJob;
public:
employee() { age = 0; id = 0; salary = 0; } // default constructor: age=0, id=0, salary=0
void setAge(int ageValue) {
age = ageValue; employee();
} // let age = ageValue
void setId(int idValue) { id = idValue; employee(); } // let id = idValue
void setSalary(float salaryValue) {
salary = salaryValue; employee();
} // salary = salaryValueint
int getAge(); // return age
int getId(); // return id
float getSalary(); // return salary};
void setjobTitle(string title) { jobTitle.assign(title); }
string getJobTitle() { return jobTitle; }
void settimeOnJob(float timer) { timeOnJob = timer; }
float gettimeOnJob() { return timeOnJob; }
};
int employee::getAge()
{
return age;
}
int employee::getId() { return id; }
float employee::getSalary() {
return salary;
}
const int arg2 = 2;
const int arg3 = 3;
void printemployee(employee *objarr[arg2][arg3],int ar2, int ar3)
{
static int z = 0;
for (int j = 0; j < arg2; j++)
{
for (int i = 0; i < arg3; i++)
{
z++;
cout << "employee"<< z << " age:" << objarr[j][i]->getAge();
cout << " employee" << z << " id:" << objarr[j][i]->getId();
cout << " employee" << z << " salary:" << objarr[j][i]->getSalary() << endl;
}
}
}
class supervisor:public employee
{
private:
int numberOfTeamsSupervised;
int numberOfEmployeesSupervised;
public:
void setteamsupervised(int supervised) { numberOfTeamsSupervised = supervised; }
int getsupervised() { return numberOfTeamsSupervised; }
void setnumberofemployees( int emp) { numberOfEmployeesSupervised = emp; }
int getnumberofemployees() { return numberOfEmployeesSupervised; }
};
class staff:public employee
{
private:
bool teamLeader;
string applicationSupported[3];
string jobSkill[3];
public:
void setapplication(string app[3]) {
for (int i = 0; i < 3; i++)
{
applicationSupported[i].assign(app[i]);
}
}
void setjobskill(string jobskil[3]) {
for (int i = 0; i < 3; i++)
{
jobSkill[i].assign(jobskil[i]);
}
}
};
void main()
{
employee companyEmployees[2][3],*arg1[2][3];
companyEmployees[0][0].setAge(30); companyEmployees[0][0].setId(111); companyEmployees[0][0].setSalary(30000);
companyEmployees[0][1].setAge(31); companyEmployees[0][1].setId(112); companyEmployees[0][1].setSalary(31000);
companyEmployees[0][2].setAge(32); companyEmployees[0][2].setId(113); companyEmployees[0][2].setSalary(32000);
companyEmployees[1][0].setAge(33); companyEmployees[1][0].setId(114); companyEmployees[1][0].setSalary(33000);
companyEmployees[1][1].setAge(34); companyEmployees[1][1].setId(115); companyEmployees[1][1].setSalary(34000);
companyEmployees[1][2].setAge(35); companyEmployees[1][2].setId(116); companyEmployees[1][2].setSalary(35000);
//arg1[1][1] = &companyEmployees[1][1];
for (int j = 0; j < arg2; j++)
{
for (int i = 0; i < arg3; i++)
{
arg1[j][i] = &companyEmployees[j][i];
}
}
string h, a, j;
string stringholder[3];
staff s;
supervisor super;
s.setapplication(stringholder);
super.setnumberofemployees(5);
super.setteamsupervised(6);
super.settimeOnJob(4);
cout< cout< cout< system("pause"); } Draw three UML class diagrams, one for each of the classes mentioned above 2.) Draw a generalization among the three class diagrams, showing the inheritance relationship. 3. turn intp pseudocode
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
