Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can solve this in two ways in c++ with header file /implembtetion Question 1: Use the class Employee to complete the following task. Implement Company

can solve this in two ways in c++
with header file /implembtetion image text in transcribed
image text in transcribed
image text in transcribed
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 Get TotalSalaries which returns the sum of all Employees' salaries in the same Company. 7. A friend function removeEmployee From Company (Company& current Company, 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 Companyl. - 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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions