Question: in c++ employee.h #include #include using namespace std; #ifndef EMPLOYEE_H #define EMPLOYEE_H class Employee{ private: int ID_; string name_; int salary_; public: Employee(); ~Employee(); Employee(int

in c++
employee.h
#include
#include
using namespace std;
#ifndef EMPLOYEE_H
#define EMPLOYEE_H
class Employee{
private:
int ID_;
string name_;
int salary_;
public:
Employee();
~Employee();
Employee(int ID, string name,int salary );
void setName(string name);
string getName();
void setID(int ID);
int getID();
void setSalary(int salary);
int getSalary();
void printDetails();
};
#endif
\\\\\\\
employee.cpp
#include "Employee.h"
Employee::Employee(){
setSalary(0);
setID(0);
setName("No_Name");
}
Employee::~Employee(){}
Employee::Employee(int ID, string name,int salary ){
setSalary(salary);
setID(ID);
setName(name);
}
void Employee::setName(string name){
name_=name;
}
string Employee::getName(){
return name_;
}
void Employee::setID(int ID){
ID_=ID;
}
int Employee::getID(){
return ID_;
}
void Employee::setSalary(int salary){
salary_=salary;
}
int Employee::getSalary(){
return salary_;
}
void Employee::printDetails(){
cout
cout
cout
}
 in c++ employee.h #include #include using namespace std; #ifndef EMPLOYEE_H #define
EMPLOYEE_H class Employee{ private: int ID_; string name_; int salary_; public: Employee();
~Employee(); Employee(int ID, string name,int salary ); void setName(string name); string getName();
Question 1: Use the class Employee to complete the following task. Implement Company class for selling Employees as follows: 1. The member variables: - Company id: int. - Company location: string. - number of Employees: int. It is unknown and can vary from one Company to another. - Employees: Employee array, its size is the number of Employees. 2. A Company class constructor that receives: Company number and location. You have to use this pointer. 3. A member function void SetEmployees( Employee * n, int num_of_Employees) which sets the Employees for the Company according to received array of Employees. Note that this function can be used to change the Employees as well. 4. A Destructor for Company Class. 5. copy constructor. 6. A member function GetTotalSalaries which returns the sum of all Employees' salaries in the same Company. 7. A friend function removeEmployee From Company (Company& currentCompany, int i): this function remove the ith Employee from the array Employees in the currentCompany object and shifts remaining Employees. I should be in a proper range. Note: you have to create new Employee array. 8. A friend function printDetails(Company& e) to print the details of the Company write a main function consists of the following: 1. create an object of type Company called Companyi. - Company id: 1 - Company location: Amman - number of Employees: 3 - Employees: fill the Employees from the user 2. create an object of type Company called Companylcopy, it is a copy of the object Companyi. Use the copy constructor. 3. call the function removeEmployeeFromCompany to remove the first element in the Employees array of Companyl. 4. call the printDetails function for the two objects. Lab Objectives: Practice dynamic memory allocation and de-allocation. Understand the difference between shallow and deep copy. This pointer. Friend function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!