akosiraff

Download Employee Benefit C/C++ Answer

May 30th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1.  
  2. Download: https://solutionzip.com/downloads/employee-benefit/
  3. On microsoft visual studio C++
  4. The only change to the Employee class is that there is a new attribute:
  5. +benefit : Benefit
  6. Notice that there is a “+” for this attribute, meaning that it is public. Make sure to examine the multi-arg constructor’s signature!
  7. Also, the dotted directed line between Employee and iEmployee specifies that the Employee class must implement the iEmployee abstract class, and thus provide an implementation for the calculatePay method.The only change to the Employee class is that there is a new attribute:
  8. +benefit : Benefit
  9. Notice that there is a “+” for this attribute, meaning that it is public. Make sure to examine the multi-arg constructor’s signature!
  10. Also, the dotted directed line between Employee and iEmployee specifies that the Employee class must implement the iEmployee abstract class, and thus provide an implementation for the calculatePay method.
  11. Using the UML Diagrams from
  12. Step 1, create the Benefit class. To get an idea of how to format displayBenefits, take a look at the output in Step 5.
  13. Add a Benefit attribute to the Employee class.
  14. Initialize the new Benefit attribute in both Employee constructors. Again, take note of the multi-arg constructors parameter list!
  15. Create the iEmployee interface (abstract class in C++).
  16. Modify the Employee class to implement the new interface so that Employee will have to implement the calculatePay method.
  17. Modify the Employee class to call displayBenefit when displaying Employee information.
  18. Notice that the Employee class now has a public benefit object inside it. This means that you can access the set methods of the Benefit object with the following code:
  19. .benefit.
  20. As an example, to set the lifeInsurance attribute inside an Employee object called emp, we could execute the following code:
  21. emp.benefit.setLifeInsurance(lifeInsurance);
  22. The steps required to modify the Main class are below. New steps are in bold.
  23. Create an Employee object using the default constructor.
  24. Prompt for and then set the first name, last name, and gender. Consider using your getInput method from Week 1 to obtain data from the user for this step as well as Step 3.
  25. Prompt for and then set the dependents and annual salary using the overloaded setters that accept Strings.
  26. Prompt for and set healthInsurance, lifeInsurance, and vacation.
  27. Using your code from Week 1, display a divider that contains the string “Employee Information”.
  28. Display the Employee Information.
  29. Display the number of employees created using getNumEmployees(). Remember to access getNumEmployees using the class name, not the Employee object.
  30. Create a Benefit object called benefit1 using the multi-arg construction. Use any information you want for health insurance, life insurance, and vacation.
  31. Create another Employee object and use the constructor to fill it with the following:
  32. “Mary”, “Noia”, ‘F’, 5, 24000.0, benefit1
  33. Using your code from Week 1, display a divider that contains the string “Employee Information”.
  34. Display the employee information.
  35. Display the number of employees created usinusing getNumEmployees(). Remember to access getNumEmployees using the class name, not the Employee object.
  36. You May Also Download
  37.  
  38. Download: https://solutionzip.com/downloads/employee-benefit/
Add Comment
Please, Sign In to add comment