CIS 247C iLab 4 of 7: Composition and Class Interfaces
- 608 views
CIS 247C Week 4 Lab Devry University ...
CIS 247C Week 4 Lab Devry University
Computer Science - Object-Oriented Programming
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:
Create a Benefit class.
Integrate the Benefit class into the Employee class.
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:
Create a new project and name it "CIS247C_WK4_Lab_LASTNAME".
- Total Views
- Views on SlideShare
- Embed Views