C C C Create a class called consultCo that holds a private s
C++ C++ C++
Create a class called consultCo that holds a private struct called employee that contains the name, pay rate and social security number of an employee of a consulting firm called consultCo. The consultCo class should also have a vector that holds all of the objects of all of the employees in the vector. This will be a vector of employee objects. The consultCo class must be enclosed in a custom namespace. You can choose the name of the namespace.
Here is a logical diagram of this vector of objects:
Minimum Requirements:
An add function to hire a new employee. This function should create a new object with the employee information (name, payrate and social security number) and then it should add that new object to the vector. You are not required to update an employee’s data if the employee exists.
A report function that will display the name, pay rate and social security number of all employees.
A raise function that will give all employees a 10% raise.
also need a main function that creates calls the function(s) you created to meet the requirements of this project
object of the employee class Jones name 12.5 Pay rate SSN vector of objects Liang avis Allen (objects may contain 15.4. 13.2 12.9 LE3aasd more than one type)Solution
#include<bits/stdc++.h>
using namespace std;
struct employee
{
string name;
float pay_rate;
int ssn;
};
namespace ns {
class consultCo;
}
class ns::consultCo
{
private:
employee e;
vector<employee> v;
public:
void hireEmp()
{
cout<<\"Enter name\ \";
cin>>e.name;
cout<<\"Enter pay_rate\ \";
cin>>e.pay_rate;
cout<<\"Enter SSN\ \";
cin>>e.ssn;
v.push_back(e);
}
void display()
{
for (int i = 0; i < v.size(); ++i)
{
cout<<\"Name is \"<<v[i].name<<endl;
cout<<\"pay_rate is \"<<v[i].pay_rate<<endl;
cout<<\"SSN is \"<<v[i].ssn<<endl;
}
}
void raise()
{
for (int i = 0; i < v.size(); ++i)
{
v[i].pay_rate=v[i].pay_rate+v[i].pay_rate*10/100;
}
}
};
int main(int argc, char const *argv[])
{
ns::consultCo cobj;
cout<<\"hiring new employee\ \";
cobj.hireEmp();
cobj.display();
cobj.raise();
cout<<\"After Rasie \ \";
cobj.display();
return 0;
}
========================================================
akshay@akshay-Inspiron-3537:~/Chegg$ g++ consultCo.cpp
akshay@akshay-Inspiron-3537:~/Chegg$ ./a.out
hiring new employee
Enter name
akshay
Enter pay_rate
100
Enter SSN
11111
Name is akshay
pay_rate is 100
SSN is 11111
After Rasie
Name is akshay
pay_rate is 110
SSN is 11111

