Make a UML then write a class named Employee that has the following member variables:NO ARRAYS!¨ name: The name attribute holds an employee's first and last name¨ idNumber: The idNumber...

1 answer below »
May i get help on this assignment please.


Make a UML then write a class named Employee that has the following member variables: NO ARRAYS! ¨ 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 departmentand 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 the name, idNumber, department, and positionattributes to the empty string (""). The yearsWorked attribute 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 the set yearsWorked return a boolean true if successful change, else a false. Have main routine input years worked then pass it to the set method for employees not using the constructor that sets all attributes ¨ Note: set routines may or may not return a boolean, depends on the data being changed (sometimes it’s not important to check the data). If a boolean is returned, the calling routines needs to check that boolean. In this case, only the set yearsWorked routine will have a boolean return, the others are just void return. 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 Jenny Jacobs should use the constructor that takes all the values, Myron Smith will take the constructor that has the name and ID only (and use the sets to fill in the rest of the information), and have Chris use the default and have to use ALL the sets. Note: you only have to have main input the Years Worked column from the keyboard then call setYearsWorked (only for the employees with missing data like Myron and Chris). 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 though use setw even though it will right justify the strings - looks odd). Note: you can use the directive of "left" just before setw to make the strings left justify then "right" just before setw to make the values right justify. It is optional, however. Recommended to use a void function like: printEmployee(Employee e) Note: printEmployee is NOT a member of the Employee class and do NOT make it so! The program utilizing the employee class should be in a separate .cpp file. Name this program employeeTest.cpp.
Answered Same DayDec 09, 2022

Answer To: Make a UML then write a class named Employee that has the following member variables:NO ARRAYS!¨...

Vikas answered on Dec 09 2022
34 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here