C++ 16.14 (Employee Class) Create a class called Employee that includes three pieces of information as data members—a first name (type string), a last name (type string) and a monthly salary (type...



C++


16.14 (Employee Class) Create a class called Employee that includes three pieces of information as data members—a first name (type string), a last name (type string) and a monthly salary (type int). Your class should have a constructor that initializes the three data members. Provide a set and a get function for each data member. If the monthly salary is not positive, set it to 0. Write a test program that demonstrates class Employee’s capabilities. Create two Employee objects and display each object’s yearly salary. Then give each Employee a 10 percent raise and display each Employee’s yearly salary again.



-



So I now have this code but I'd like to make adjustments to the answer (The code below). Additions will be at the very bottom.



-



//Employee.h
#include #include #ifndef Employee_h #define Employee_h


using namespace std;


class Employee { private: // variable to store name and salary string FirstName; string LastName; int Salary;


public: Employee(); void setFirstName(string name);// set the Employee name string getFirstName();// get employee name void setLastName(string lastname);// set the LastName string getLastName();// get the LastName void setSalary(int salary);// set employee salary int getSalary();// get the Salary


}; #endif



// Employee.cpp
#include #include #include "Employee.h" using namespace std;


Employee::Employee() { FirstName = "ayush"; LastName = "verma"; Salary = 100000; }


void Employee::setFirstName(string name) { FirstName=name; }


string Employee::getFirstName() { return FirstName; }


void Employee::setLastName(string lastName) { LastName=lastName; }


string Employee::getLastName() { return LastName; }


void Employee::setSalary(int salary) { if(salary Salary = 0; else Salary = salary; }


int Employee::getSalary() { return Salary; }



// main.cpp
#include #include "Employee.h"


using namespace std; int main() { Employee emp1; Employee emp2;



emp1.setFirstName("alex"); emp1.setLastName("hales"); emp1.setSalary(20000);



emp2.setFirstName("joe"); emp2.setLastName("burns"); emp2.setSalary(67000); cout<><><><><><> cout<><><><><><>



cout<> cout<><><><><><> cout<><><><><><>



return 0; }



ADDITONAL


In the main, ask the user for employees in a loop. Store each Employee class in a vector. When the user enters QUIT for the employee name, then they are done entering employees.


Once the user is done entering employees, then loop through the employees in your vector and print out the employees full name and their yearly salary. Once the loop is done, print out the employee (and salary) who made the most, and the employee (and salary) that made the least.


Finally, loop one more time and give each employee a 10% raise, and then show the employee full name, and yearly salary again.

May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here