Discount Get CIS 247C ALL WEEKS Solution ONLY $83.95 $111.93
CIS 247C Week 1 - C++ Programming [$9.99]
CIS 247C Week 2 - C++ Programming – Object Construction and Dat... [$15.99]
CIS 247C Week 3 - C++ Programming – Overloaded Methods and Stat... [$15.99]
CIS 247C Week 4 - C++ Programming – Composition and Class Inter... [$19.99]
CIS 247C Week 5 - C++ Programming – Composition, Inheritance, a... [$19.99]
CIS 247C Week 6 - C++ Programming – Abstract Class and Polymorp... [$19.99]
CIS 247C Week 7 - C++ Programming - Putting It All Together [$9.99]
Get Selected Weeks Solution with ONLY NOT Add Selected Tutorials To Cart
CIS247 CIS 247 CIS/247 - CIS247C - Week 4 - Lab 4 - iLab 4 - C++ Programming – Composition and Class Interfaces – Guaranteed 100% score
    CIS247 CIS 247 CIS/247 - CIS247C - Week 4 - Lab 4 - iLab 4 - C++ Programming – Composition and Class Interfaces – Guaranteed 100% score

CIS247 CIS 247 CIS/247 - CIS247C - Week 4 - Lab 4 - iLab 4 - C++ Programming – Composition and Class Interfaces – Guaranteed 100% score

$19.99

iLab 4 of 7: Composition and Class Interfaces

The objective of the lab is to modify the Employee class to demonstrate composition where a containing class (Employee) contains another class (Benefit). An employee typically has benefits, so we will make the following changes:

  1. Create a Benefit class.
  2. Integrate the Benefit class into the Employee class.
  3. Separate the files in the project into Presentation and Logic tier folders

STEP 1: Understand the UML Diagram

The only change to the Employee class is that there is a new attribute:

+benefit : Benefit

Notice that there is a "+" for this attribute, meaning that it is public. Make sure to examine the multi-arg constructor's signature!

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.

STEP 2: Create the Project

 

You will want to use the Week 3 project as the starting point for the lab. To do this, you will want to create a new project by following these steps:

  1. Create a new project and name it "CIS247C_WK4_Lab_LASTNAME".
  2. Copy all the source files from the Week 3 project into the Week 4 project.
  3. Before you move on to the next step, build and execute the Week 4 project.

STEP 3: Modify the Employee Class

 

  1. Using the UML Diagrams from Step 1, create the Benefit class. To get an idea of how to format displayBenefits, take a look at the output in Step 5.
  2. Add a Benefit attribute to the Employee class.
  3. Initialize the new Benefit attribute in both Employee constructors. Again, take note of the multi-arg constructors parameter list!
  4. Create the iEmployee interface (abstract class in C++).
  5. Modify the Employee class to implement the new interface so that Employee will have to implement the calculatePay method.

class Employee :

public iEmployee

  1. Modify the Employee class to call displayBenefit when displaying Employee information.

STEP 4: Modify the Main Method

 

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:

<Employee object>.benefit.<method>

As an example, to set the lifeInsurance attribute inside an Employee object called emp, we could execute the following code:

emp.benefit.setLifeInsurance(lifeInsurance);

The steps required to modify the Main class are below. New steps are in bold.

  1. Create an Employee object using the default constructor.
  2. 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.
  3. Prompt for and then set the dependents and annual salary using the overloaded setters that accept Strings.
  4. Prompt for and set healthInsurance, lifeInsurance, and vacation.
  5. Using your code from Week 1, display a divider that contains the string "Employee Information".
  6. Display the Employee Information.
  7. Display the number of employees created using getNumEmployees(). Remember to access getNumEmployees using the class name, not the Employee object.
  8. Create a Benefit object called benefit1 using the multi-arg construction. Use any information you want for health insurance, life insurance, and vacation.
  9. Create another Employee object and use the constructor to fill it with the following:
    "Mary", "Noia", 'F', 5, 24000.0, benefit1
  10. Using your code from Week 1, display a divider that contains the string "Employee Information".
  11. Display the employee information.
  12. Display the number of employees created using getNumEmployees(). Remember to access getNumEmployees using the class name, not the Employee object.

Solution for CIS247 Week 4 Lab 4 in C++, Contain C++ project (Using Visual Studio)

It is 100% correct solution

If you have more questions, please contact me via email support@extutorials.com, i will help you any time

Thank you

Attached Files

Move over [ preview ] file name to preview content in it!

Write a review

Your Name:


Your Review: Note: HTML is not translated!

Rating: Bad           Good

Enter the code in the box below:



PURCHASE SAVE
2 Tutorials 10%
3 Tutorials 13%
4 Tutorials 16%
5 Tutorials 19%
6 Tutorials 22%
7 Tutorials 25%
8 Tutorials 28%
9 Tutorials 31%
10 Tutorials 34%
add url more

9MZQASHWN73B