Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

2.1.

2022 Project in Object-Oriented Programming

Anas Bilal Khalil


#include <iostream>
using namespace std;

class Employee {
protected:
string name, gender;
int age, years_of_experience;

public:
Employee(string name, string gender, int age, int years_of_experience) {
this->name = name;
this->gender = gender;
this->age = age;
this->years_of_experience = years_of_experience;

virtual void typeOfWork() = 0;


virtual int setSalary() = 0;
virtual void showInformation() = 0;

};

class HumanResource : public Employee {

public:
HumanResource(string name, string gender, int age, int years_of_experience) :
Employee(name, gender, age, years_of_experience) {
this->name = name;
this->gender = gender;
this->age = age;
this->years_of_experience = years_of_experience;
}

void typeOfWork() {
cout << "Human resources (HR) is the set of people who make up the workforce of an
organization, business sector, industry, or economy. A narrower concept is human capital,
the knowledge and skills which the individuals command. Similar terms include manpower,
labor, personnel, associates or simply: people." << endl;
}

void showInformation() {
cout << "Name : " << name;
cout << "\nGender : " << gender;
cout << "\nType of Work : Human Resource";
cout << "\nAge : " << age;
cout << "\nYears of Experience : " << years_of_experience << endl;
}

int setSalary() {
return 1500 * (years_of_experience / 2);
}
};

class SalesOfficer : public Employee {

public:
SalesOfficer(string name, string gender, int age, int years_of_experience) :
Employee(name, gender, age, years_of_experience) {
this->name = name;
this->gender = gender;
this->age = age;
this->years_of_experience = years_of_experience;
}

void typeOfWork() {
cout << "Sales officers are executives that work with companies’ sales teams to
determine the best strategies to increase customer purchases. They assist higher management
in developing reasonable sales goals, oversee the activities of sales employees, and
collaborate with marketing teams to expand brand presence." << endl;
}

void showInformation() {
cout << "Name : " << name;
cout << "\nGender : " << gender;
cout << "\nType of Work : Sale Officers";
cout << "\nAge : " << age;
cout << "\nYears of Experience : " << years_of_experience << endl;
}

int setSalary() {
return 1800 * (years_of_experience / 2);
}
};

class IT : public Employee {

public:
IT(string name, string gender, int age, int years_of_experience) : Employee(name,
gender, age, years_of_experience) {
this->name = name;
this->gender = gender;
this->age = age;
this->years_of_experience = years_of_experience;
}

void typeOfWork() {
cout << "IT Employees means those personnel employed by Customer within customer’s
IT department. “Floating Users” shall mean the maximum number of individuals out of a total
user population, authorized by the Customer to access the Software at a given point in
time." << endl;
}

void showInformation() {
cout << "Name : " << name;
cout << "\nGender : " << gender;
cout << "\nType of Work : IT";
cout << "\nAge : " << age;
cout << "\nYears of Experience : " << years_of_experience << endl;
}

int setSalary() {
return 5000 * (years_of_experience / 2);
}
};

class Company {
HumanResource hr;
SalesOfficer so;
IT it;

public:
Company(HumanResource newhr, SalesOfficer newso, IT newit) : hr(newhr), so(newso),
it(newit) { };
void informationEmployee() {
hr.showInformation();
cout << "The Salary =" << hr.setSalary() <<"$ " << endl;
hr.typeOfWork();
cout << endl;
it.showInformation();
cout << "The Salary =" << it.setSalary() << "$ " << endl;
it.typeOfWork();
cout << endl;
so.showInformation();
cout << "The Salary =" << so.setSalary() << "$ " << endl;
so.typeOfWork();
}
};

int main() {

Company solo = Company(HumanResource("Ahemd", "Male", 25, 3), SalesOfficer("Sara",


"Female", 23, 2), IT("Anas", "Male", 20, 2));
solo.informationEmployee();

system("pause>0");
return 0;
}

The output:

You might also like