The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
THIS IS FOR C++. THERE MUST BE 3 FILES(2 CPP, 1 HEADER) FOR THIS PROGRAM AND IT MUST WORK IN VISUAL STUDIO 2013,
Submit your source code files (all .h and .cpp files) and your UML diagrams
Make sure and use three separate files for your object oriented programs (this means for each program you need to submit three files
(two .cpp files and 1 .h file) plus UML diagrams. Do not use inline functions
: These programs require UML diagrams
Make a UML then write a class named Employee that has the following member variables:
¨ name: The name attribute holds an employee’s first and last name
¨ idNumber: The idNumber attribute is a string variable that holds an employee’s ID number
¨ department: The department attribute holds the name of the employee’s department
¨ position: The position attribute holds the name of the employee’s job title
¨ yearsWorked: This attribute holds the number of years the employee has worked at the company
The class should have the following overloaded constructors:
¨ A constructor that accepts the following values as arguments and assigns them to the appropriate data members (attributes): employee’s name and employee’s ID number, employee’s department, employee’s position, and the number of years the employee has worked at the company.
¨ A constructor that accepts the fallowing values as arguments and assigns them to the appropriate data members (attributes): employee’s name and employee’s ID number. The department and position attributes should be initialized to the empty string (“”) and the yearsWorked attribute should be initialized to zero.
¨ A default constructor (accepts no arguments) that initializes thename,idNumber, department, and position attributes to the empty string (“”). TheyearsWorkedattribute should be initialized to zero.
Write Get and Set methods for each attribute: name, idNumber,department,position, and yearsWorked.
¨ Do not allow the yearsWorked attribute to be set to values less than zero. If an attempt is made to set yearsWorked to less than zero, do not set the attribute then communicate the problem to the calling program. Do not use cin or cout in the set method. Have main routine input years worked then pass it to the set method for employees not using the constructor that sets all attributes
Remember that the class declaration (.h file) will contain the class attributes and function prototypes. Name the class declaration file employee.h. The class implementation file (.cpp) will contain the function definitions (don’t forget to include the employee.h file). Name the class implementation file employee.cpp.
Next create a program to utilize the Employee class you created in the following manner:
1. Instantiate three Employee objects as follows:
|
Name |
ID Number |
Department |
Position |
Years Worked |
|
Jenny Jacobs |
JJ8990 |
Accounting |
President |
15 |
|
Myron Smith |
MS7571 |
IT |
Programmer |
5 |
|
Chris Raines |
CR6873 |
Manufacturing |
Engineer |
30 |
Note: you only have to have main input the Years Worked from the keyboard then call setYearsWorked (only for the employees with missing data). All other fields can be “hardcoded” (ex: emp2.setDepartment(“IT”); ).
Also note: NO ARRAYS! Create 3 separate Employee objects each using a different constructor
2. Display the data for each of the three employees to the screen (you do not need to display the lines in the table)
The program utilizing the employee class should be in a separate .cpp file. Name this program employeeTest.cpp.
Please take the time to go over this and make sure it compiles without any errors in Visual Studio 2013, thank you.