Must be in C++ and cannot come from any online source. Please include all requested parts in problem. Create a class named Employee that has the following member variables: name - a string that holds the employee's name empIdNumber - an int variable that holds the employee's ID Number job - a string that holds the name of the position the employee is working in (Laborer, Manager, Secretary, etc.) yearsOfService- an integer that holds the employee's years of service The class should have the following constructors: A constructor with the following values as parameter arguments and assigns them to the appropriate member variables: employee's name, employee ID number, job and years of service that are passed to them when the object is created (pass each of the four values into the constructor) A constructor with the following values as parameter arguments and assigns them to the appropriate member variables: employee's name and ID Number. The job field should be assigned an empty string ("") and the yearsOfService should be set to 0 inside the constructor. A default constructor that assigns empty strings ("") to the name, Id number and job member variables, and 0 to the years of service member variable. Write appropriate mutator functions that store values in these member variables and accessor functions that return the values in these member variables (this will help with the final displaying of data). Once you have written the class definition in your program, create four Employee objects to hold the following data: Name: ID Number Job Years of Service Susan Harris 47899 Manager 24 Johnny Smith 12345 Laborer 15 Jan Solomon 45278 Secretary 8 Harry Jones 85634 Laborer 0 The program should store this data in the four objects and then display the data for each employee on the screen (by using a public accessor function called by each employee object). Create one student from each of the contstructors above to demonstrate that each constructor works. You may then create the fourth student by using any of the constructors your created. You will then need to use public mutator functions to set values for objects created using the second and third constructor.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Must be in C++ and cannot come from any online source. Please include all requested parts in problem.
-
Create a class named Employee that has the following member variables:
- name - a string that holds the employee's name
- empIdNumber - an int variable that holds the employee's ID Number
- job - a string that holds the name of the position the employee is working in (Laborer, Manager, Secretary, etc.)
- yearsOfService- an integer that holds the employee's years of service
The class should have the following constructors:
- A constructor with the following values as parameter arguments and assigns them to the appropriate member variables: employee's name, employee ID number, job and years of service that are passed to them when the object is created (pass each of the four values into the constructor)
- A constructor with the following values as parameter arguments and assigns them to the appropriate member variables: employee's name and ID Number. The job field should be assigned an empty string ("") and the yearsOfService should be set to 0 inside the constructor.
- A default constructor that assigns empty strings ("") to the name, Id number and job member variables, and 0 to the years of service member variable.
Write appropriate mutator functions that store values in these member variables and accessor functions that return the values in these member variables (this will help with the final displaying of data). Once you have written the class definition in your program, create four Employee objects to hold the following data:
Name: ID Number Job Years of Service
Susan Harris 47899 Manager 24
Johnny Smith 12345 Laborer 15
Jan Solomon 45278 Secretary 8
Harry Jones 85634 Laborer 0The program should store this data in the four objects and then display the data for each employee on the screen (by using a public accessor function called by each employee object).
Create one student from each of the contstructors above to demonstrate that each constructor works. You may then create the fourth student by using any of the constructors your created. You will then need to use public mutator functions to set values for objects created using the second and third constructor.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images