|Get Selected Weeks Solution with ONLY||NOT||Add Selected Tutorials To Cart|
iLab 4 of 7: Composition and Class Interfaces
Submit your assignment to the Dropbox located on the silver tab at the top of this page.
(See Syllabus “Due Dates for Assignments & Exams” for due dates.)
i L A B O V E R V I E W
Scenario and Summary
The objective of the lab is to modify the Employee class to demonstrate composition and a class interface. An employee typically has benefits, so we will make the following changes:
Employee class. A tutorial on interfaces can be downloaded here.
Due this week:
i L A B S T E P S
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:
STEP 3: Modify the Employee Class
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:
As an example, to set the lifeInsurance attribute inside an Employee object called emp, we could execute the following code:
The steps required to modify the Main class are below. New steps are in bold.
STEP 5: Compile and Test
When done, compile and execute your code. Debug any errors until your code is error-free.
Check your output to ensure that you have the desired output, modify your code as necessary, and rebuild.
Your output should resemble the following:
Screenshot of program that reads:
************** Employee Information **************
First Name: John
Last Name: Doe
Annual Salary: $73,000.00
Weekly Pay: $1,403.85
Health Insurance: Partial
Life Insurance: 500.0
Total employees: 1
*************** Employee Information ***************
First Name: Mary
Last Name: Noia
Annual Salary: $24,000.00
Weekly Pay: $461.54
Health Insurance: Full
Life Insurance: 100.0
Total employees: 2
STEP 6: Submit Deliverables
Submit your lab to the Dropbox located on the silver tab at the top of this page. For instructions on how to use the Dropbox, read these Step-by-Step Instructions or watch this Dropbox Tutorial.
See Syllabus “Due Dates for Assignments & Exams” for due date information.
Solution for CIS247 Week 4 Lab 4 in Java
It is 100% correct solution
How to using solution?
Using any Java IDE (ex Eclipse or Netbean), copy all source codes to src folder, then open and run main class (File BasicUserInterface.Java).
If you have more questions, please contact me via email email@example.com, i will help you any time