SlideShare a Scribd company logo
CIS247A iLab 4 Composition and Class
Interfaces

Click this link to get the tutorial:
http://homeworkfox.com/tutorials/general-
questions/4463/cis247a-ilab-4-composition-
and-class-interfaces/
Week 4: Designing Using Objects - iLab


                                                                                                  Print This
                                                                                                      Page



iLab 4 of 6: Composition and Class Interfaces/Abstract Class



                                       Connect to the iLab here.


        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.)




 iLAB OVERVIEW
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:

    1. Create a Benefits class.
    2. Integrate the Benefit class into the Employee class.
    3. Create an iEmployee abstract class to guarantee that calculatePay is implemented in the
       Employee class. A tutorial on interfaces can be downloaded here.
Deliverables

Due this week:

          Capture the Console output window and paste it into a Word document.
          Zip the project folder files.
          Put the zip file and screen shots (Word document that contains programming code and screen
          shots of program output) in the Dropbox.


 iLAB STEPS

STEP 1: Understand the UML Diagram




Employee - firstName : string - lastName : string - gender : char - dependents : int - annualSalary : double - static
numEmployees : int = 0 +benefit : Benefit +Employee() +Employee(in fname : String, in lname : String, in gen : char, in dep :
int, in sal : double) +calculatePay() : double +displayEmployee() : void +static getNumEmployees() : int +getFirstName() :
string +setFirstName(in name : String) : void +getLastName() : String +setLastName(in name : String) : void +getGender() :
char +setGender(in gen : char) : void +getDependents() : int +setDependents(in dep : int) : void +getAnnualSalary() : double
+setAnnualSalary(in sal : double) : void +setAnnualSalary(in sal : String) : void <<interface>> Fido : Animal +calculatePay() :
double Benefit -healthinsurance : string -lifeinsurance : double -vacation : int +Benefit() +Benefit(in health : string, in life :
double, in vacation : int) +displayBenefits() : void +getHealthInsurance() : string +setHealthInsutance(in hins : string) : void
+getLifeInsurance() : double +setLifeInsurance(in lifeIns : double) : void +getVacation() : int +setVacation(in vaca : int) : void

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

    6.   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.



STEP 5: Compile and Test
When done, compile and run your code.

Then, 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.



STEP 6: Screen Prints

Capture the Console output window and paste it into a Word document. The following is a sample screen
print.




Screenshot of program output that reads: CIS247CWeek4iLab' CMD.EXE was started with the above path as the current
directory. UNC paths are not supported. Defaulting to Windows directory. Welcome to your Object Oriented Program--
Employee ClassCIS247C, Week 4 LabName: Prof.Nana Liu *************** Employee 1 *************** Please enter your First
Name Nana Please enter your Last Name Liu Please enter your Gender Female Please enter your Dependents 2 Please
enter your Annual Salary 60000 Please enter your Health InsuranceCigna Please enter your Life Insurance1.5 Please enter
your Vacation Days21 Employee Information ________________________________________ Name: Nana Liu Gender: F
Dependents: 2 Annual Salary: 60000.00 Weekly Salary: 1153.85 Benefit Information
________________________________________ Health Insurance: Cigna Life Insurance: 1.50 Vacation: 21 days ---
Number of Employee Object Created --- Number of employees: 1 ************** Employee 2 ************** Employee
Information _______________________________________ Name: Mary Noia Gender: F Dependents: 2 Annual Salary:
150000.00 Weekly Salary: 2884.62 Benefit Information _______________________________________ Health Insurance:
North West Mutual Life Insurance: 5000000.00 Vacation: 14 days --- Number of Employee Object Created --- Number of
employees: 2 The end of the CIS247C Week4 iLab. Press any key to continue...


STEP 7: Submit Deliverables

         Capture the Console output window and paste it into a Word document.
         Put the zip file and screen shots (Word document that contains programming code and screen
         shots of program output) in the Dropbox.

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.

More Related Content

Viewers also liked

Cis247 a ilab 3 overloaded methods and static methods variables
Cis247 a ilab 3 overloaded methods and static methods variablesCis247 a ilab 3 overloaded methods and static methods variables
Cis247 a ilab 3 overloaded methods and static methods variablescis247
 
Cis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interfaceCis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interfacecis247
 
Cis247 i lab 7 of 7 putting it all together
Cis247 i lab 7 of 7 putting it all togetherCis247 i lab 7 of 7 putting it all together
Cis247 i lab 7 of 7 putting it all togethercis247
 
Herathera island resort 2012(new)
Herathera island resort 2012(new)Herathera island resort 2012(new)
Herathera island resort 2012(new)ScaevolaTravel
 
Capitulo i arquitectura pc
Capitulo i arquitectura pcCapitulo i arquitectura pc
Capitulo i arquitectura pc
Willian Yanza Chavez
 
Conceptos basicos del algebra
Conceptos basicos del algebraConceptos basicos del algebra
Conceptos basicos del algebra
Willian Yanza Chavez
 
Compensation presentation
Compensation presentation Compensation presentation
Compensation presentation
bappykazi
 
Productivity
ProductivityProductivity
Productivitybappykazi
 
Chinese Culture
Chinese Culture Chinese Culture
Chinese Culture
bappykazi
 
Six thinkinghats
Six thinkinghatsSix thinkinghats
Six thinkinghatsbappykazi
 
Import subtitution industrialization
Import subtitution industrializationImport subtitution industrialization
Import subtitution industrialization
bappykazi
 
Report on Import substitution industrialization
Report on Import substitution industrializationReport on Import substitution industrialization
Report on Import substitution industrialization
bappykazi
 
Marketing mix Analysis
Marketing mix AnalysisMarketing mix Analysis
Marketing mix Analysis
bappykazi
 

Viewers also liked (15)

Cis247 a ilab 3 overloaded methods and static methods variables
Cis247 a ilab 3 overloaded methods and static methods variablesCis247 a ilab 3 overloaded methods and static methods variables
Cis247 a ilab 3 overloaded methods and static methods variables
 
Cis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interfaceCis247 a ilab 1 of 7 creating a user interface
Cis247 a ilab 1 of 7 creating a user interface
 
Cis247 i lab 7 of 7 putting it all together
Cis247 i lab 7 of 7 putting it all togetherCis247 i lab 7 of 7 putting it all together
Cis247 i lab 7 of 7 putting it all together
 
Herathera island resort 2012(new)
Herathera island resort 2012(new)Herathera island resort 2012(new)
Herathera island resort 2012(new)
 
Capitulo i arquitectura pc
Capitulo i arquitectura pcCapitulo i arquitectura pc
Capitulo i arquitectura pc
 
Conceptos basicos del algebra
Conceptos basicos del algebraConceptos basicos del algebra
Conceptos basicos del algebra
 
WILLIAM A. SCHNEIDER - Pintor
WILLIAM A. SCHNEIDER - PintorWILLIAM A. SCHNEIDER - Pintor
WILLIAM A. SCHNEIDER - Pintor
 
Untitled Presentation
Untitled PresentationUntitled Presentation
Untitled Presentation
 
Compensation presentation
Compensation presentation Compensation presentation
Compensation presentation
 
Productivity
ProductivityProductivity
Productivity
 
Chinese Culture
Chinese Culture Chinese Culture
Chinese Culture
 
Six thinkinghats
Six thinkinghatsSix thinkinghats
Six thinkinghats
 
Import subtitution industrialization
Import subtitution industrializationImport subtitution industrialization
Import subtitution industrialization
 
Report on Import substitution industrialization
Report on Import substitution industrializationReport on Import substitution industrialization
Report on Import substitution industrialization
 
Marketing mix Analysis
Marketing mix AnalysisMarketing mix Analysis
Marketing mix Analysis
 

Similar to Cis247 a ilab 4 composition and class interfaces

Cis247 a ilab 4 composition and class interfaces
Cis247 a ilab 4 composition and class interfacesCis247 a ilab 4 composition and class interfaces
Cis247 a ilab 4 composition and class interfacesccis224477
 
Cis247 a ilab 4 composition and class interfaces
Cis247 a ilab 4 composition and class interfacesCis247 a ilab 4 composition and class interfaces
Cis247 a ilab 4 composition and class interfacesccis224477
 
Cis247 i lab 3 overloaded methods and static methods variables
Cis247 i lab 3 overloaded methods and static methods variablesCis247 i lab 3 overloaded methods and static methods variables
Cis247 i lab 3 overloaded methods and static methods variablessdjdskjd9097
 
Cis247 a ilab 3 overloaded methods and static methods variables
Cis247 a ilab 3 overloaded methods and static methods variablesCis247 a ilab 3 overloaded methods and static methods variables
Cis247 a ilab 3 overloaded methods and static methods variablesccis224477
 
Cis247 i lab 5 inheritance
Cis247 i lab 5 inheritanceCis247 i lab 5 inheritance
Cis247 i lab 5 inheritancesdjdskjd9097
 
Cis247 a ilab 5 inheritance
Cis247 a ilab 5 inheritanceCis247 a ilab 5 inheritance
Cis247 a ilab 5 inheritanceccis224477
 
Cis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classCis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classccis224477
 
Cis247 i lab 6 abstract classes
Cis247 i lab 6 abstract classesCis247 i lab 6 abstract classes
Cis247 i lab 6 abstract classessdjdskjd9097
 
Cis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classCis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classsdjdskjd9097
 
Cis247 i lab 6 abstract classes
Cis247 i lab 6 abstract classesCis247 i lab 6 abstract classes
Cis247 i lab 6 abstract classesccis224477
 
Cis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classCis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classsdjdskjd9097
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labsccis224477
 
Assignment Instructions 2_7aExplain the interrelationships bet.docx
Assignment Instructions 2_7aExplain the interrelationships bet.docxAssignment Instructions 2_7aExplain the interrelationships bet.docx
Assignment Instructions 2_7aExplain the interrelationships bet.docx
ssuser562afc1
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
gilbertkpeters11344
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docx
lorindajamieson
 
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docxStudent Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
emelyvalg9
 
Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7helpido9
 
1 Goals. 1. To use a text file for output and later for in.docx
1 Goals. 1. To use a text file for output and later for in.docx1 Goals. 1. To use a text file for output and later for in.docx
1 Goals. 1. To use a text file for output and later for in.docx
honey690131
 
need help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docxneed help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docx
niraj57
 
Lab 2: Importing requirements artifacts from a CSV file
Lab 2: Importing requirements artifacts from a CSV file Lab 2: Importing requirements artifacts from a CSV file
Lab 2: Importing requirements artifacts from a CSV file
IBM Rational software
 

Similar to Cis247 a ilab 4 composition and class interfaces (20)

Cis247 a ilab 4 composition and class interfaces
Cis247 a ilab 4 composition and class interfacesCis247 a ilab 4 composition and class interfaces
Cis247 a ilab 4 composition and class interfaces
 
Cis247 a ilab 4 composition and class interfaces
Cis247 a ilab 4 composition and class interfacesCis247 a ilab 4 composition and class interfaces
Cis247 a ilab 4 composition and class interfaces
 
Cis247 i lab 3 overloaded methods and static methods variables
Cis247 i lab 3 overloaded methods and static methods variablesCis247 i lab 3 overloaded methods and static methods variables
Cis247 i lab 3 overloaded methods and static methods variables
 
Cis247 a ilab 3 overloaded methods and static methods variables
Cis247 a ilab 3 overloaded methods and static methods variablesCis247 a ilab 3 overloaded methods and static methods variables
Cis247 a ilab 3 overloaded methods and static methods variables
 
Cis247 i lab 5 inheritance
Cis247 i lab 5 inheritanceCis247 i lab 5 inheritance
Cis247 i lab 5 inheritance
 
Cis247 a ilab 5 inheritance
Cis247 a ilab 5 inheritanceCis247 a ilab 5 inheritance
Cis247 a ilab 5 inheritance
 
Cis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee classCis247 a ilab 2 of 7 employee class
Cis247 a ilab 2 of 7 employee class
 
Cis247 i lab 6 abstract classes
Cis247 i lab 6 abstract classesCis247 i lab 6 abstract classes
Cis247 i lab 6 abstract classes
 
Cis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classCis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee class
 
Cis247 i lab 6 abstract classes
Cis247 i lab 6 abstract classesCis247 i lab 6 abstract classes
Cis247 i lab 6 abstract classes
 
Cis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee classCis247 i lab 2 of 7 employee class
Cis247 i lab 2 of 7 employee class
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labs
 
Assignment Instructions 2_7aExplain the interrelationships bet.docx
Assignment Instructions 2_7aExplain the interrelationships bet.docxAssignment Instructions 2_7aExplain the interrelationships bet.docx
Assignment Instructions 2_7aExplain the interrelationships bet.docx
 
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
33.docxSTEP 1 Understand the UML Diagram Analyze and under.docx
 
Please be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docxPlease be advised that there are four (4) programs just like this on.docx
Please be advised that there are four (4) programs just like this on.docx
 
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docxStudent Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
Student Lab Activity A. Lab # CIS CIS170A-A1B. Lab.docx
 
Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7Cis 407 i lab 6 of 7
Cis 407 i lab 6 of 7
 
1 Goals. 1. To use a text file for output and later for in.docx
1 Goals. 1. To use a text file for output and later for in.docx1 Goals. 1. To use a text file for output and later for in.docx
1 Goals. 1. To use a text file for output and later for in.docx
 
need help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docxneed help completing week 6 ilab.. i will upload what I currently ha.docx
need help completing week 6 ilab.. i will upload what I currently ha.docx
 
Lab 2: Importing requirements artifacts from a CSV file
Lab 2: Importing requirements artifacts from a CSV file Lab 2: Importing requirements artifacts from a CSV file
Lab 2: Importing requirements artifacts from a CSV file
 

Recently uploaded

Training my puppy and implementation in this story
Training my puppy and implementation in this storyTraining my puppy and implementation in this story
Training my puppy and implementation in this story
WilliamRodrigues148
 
Enterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdfEnterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdf
KaiNexus
 
Building Your Employer Brand with Social Media
Building Your Employer Brand with Social MediaBuilding Your Employer Brand with Social Media
Building Your Employer Brand with Social Media
LuanWise
 
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdfSearch Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Arihant Webtech Pvt. Ltd
 
Cracking the Workplace Discipline Code Main.pptx
Cracking the Workplace Discipline Code Main.pptxCracking the Workplace Discipline Code Main.pptx
Cracking the Workplace Discipline Code Main.pptx
Workforce Group
 
Digital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and TemplatesDigital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and Templates
Aurelien Domont, MBA
 
ikea_woodgreen_petscharity_cat-alogue_digital.pdf
ikea_woodgreen_petscharity_cat-alogue_digital.pdfikea_woodgreen_petscharity_cat-alogue_digital.pdf
ikea_woodgreen_petscharity_cat-alogue_digital.pdf
agatadrynko
 
Set off and carry forward of losses and assessment of individuals.pptx
Set off and carry forward of losses and assessment of individuals.pptxSet off and carry forward of losses and assessment of individuals.pptx
Set off and carry forward of losses and assessment of individuals.pptx
HARSHITHV26
 
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBdCree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
creerey
 
Premium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern BusinessesPremium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern Businesses
SynapseIndia
 
3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx
tanyjahb
 
BeMetals Investor Presentation_June 1, 2024.pdf
BeMetals Investor Presentation_June 1, 2024.pdfBeMetals Investor Presentation_June 1, 2024.pdf
BeMetals Investor Presentation_June 1, 2024.pdf
DerekIwanaka1
 
Buy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star ReviewsBuy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star Reviews
usawebmarket
 
FINAL PRESENTATION.pptx12143241324134134
FINAL PRESENTATION.pptx12143241324134134FINAL PRESENTATION.pptx12143241324134134
FINAL PRESENTATION.pptx12143241324134134
LR1709MUSIC
 
Authentically Social Presented by Corey Perlman
Authentically Social Presented by Corey PerlmanAuthentically Social Presented by Corey Perlman
Authentically Social Presented by Corey Perlman
Corey Perlman, Social Media Speaker and Consultant
 
Mastering B2B Payments Webinar from BlueSnap
Mastering B2B Payments Webinar from BlueSnapMastering B2B Payments Webinar from BlueSnap
Mastering B2B Payments Webinar from BlueSnap
Norma Mushkat Gaffin
 
Business Valuation Principles for Entrepreneurs
Business Valuation Principles for EntrepreneursBusiness Valuation Principles for Entrepreneurs
Business Valuation Principles for Entrepreneurs
Ben Wann
 
Recruiting in the Digital Age: A Social Media Masterclass
Recruiting in the Digital Age: A Social Media MasterclassRecruiting in the Digital Age: A Social Media Masterclass
Recruiting in the Digital Age: A Social Media Masterclass
LuanWise
 
Agency Managed Advisory Board As a Solution To Career Path Defining Business ...
Agency Managed Advisory Board As a Solution To Career Path Defining Business ...Agency Managed Advisory Board As a Solution To Career Path Defining Business ...
Agency Managed Advisory Board As a Solution To Career Path Defining Business ...
Boris Ziegler
 
ModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
ModelingMarketingStrategiesMKS.CollumbiaUniversitypdfModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
ModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
fisherameliaisabella
 

Recently uploaded (20)

Training my puppy and implementation in this story
Training my puppy and implementation in this storyTraining my puppy and implementation in this story
Training my puppy and implementation in this story
 
Enterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdfEnterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdf
 
Building Your Employer Brand with Social Media
Building Your Employer Brand with Social MediaBuilding Your Employer Brand with Social Media
Building Your Employer Brand with Social Media
 
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdfSearch Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
 
Cracking the Workplace Discipline Code Main.pptx
Cracking the Workplace Discipline Code Main.pptxCracking the Workplace Discipline Code Main.pptx
Cracking the Workplace Discipline Code Main.pptx
 
Digital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and TemplatesDigital Transformation and IT Strategy Toolkit and Templates
Digital Transformation and IT Strategy Toolkit and Templates
 
ikea_woodgreen_petscharity_cat-alogue_digital.pdf
ikea_woodgreen_petscharity_cat-alogue_digital.pdfikea_woodgreen_petscharity_cat-alogue_digital.pdf
ikea_woodgreen_petscharity_cat-alogue_digital.pdf
 
Set off and carry forward of losses and assessment of individuals.pptx
Set off and carry forward of losses and assessment of individuals.pptxSet off and carry forward of losses and assessment of individuals.pptx
Set off and carry forward of losses and assessment of individuals.pptx
 
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBdCree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
 
Premium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern BusinessesPremium MEAN Stack Development Solutions for Modern Businesses
Premium MEAN Stack Development Solutions for Modern Businesses
 
3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx
 
BeMetals Investor Presentation_June 1, 2024.pdf
BeMetals Investor Presentation_June 1, 2024.pdfBeMetals Investor Presentation_June 1, 2024.pdf
BeMetals Investor Presentation_June 1, 2024.pdf
 
Buy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star ReviewsBuy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star Reviews
 
FINAL PRESENTATION.pptx12143241324134134
FINAL PRESENTATION.pptx12143241324134134FINAL PRESENTATION.pptx12143241324134134
FINAL PRESENTATION.pptx12143241324134134
 
Authentically Social Presented by Corey Perlman
Authentically Social Presented by Corey PerlmanAuthentically Social Presented by Corey Perlman
Authentically Social Presented by Corey Perlman
 
Mastering B2B Payments Webinar from BlueSnap
Mastering B2B Payments Webinar from BlueSnapMastering B2B Payments Webinar from BlueSnap
Mastering B2B Payments Webinar from BlueSnap
 
Business Valuation Principles for Entrepreneurs
Business Valuation Principles for EntrepreneursBusiness Valuation Principles for Entrepreneurs
Business Valuation Principles for Entrepreneurs
 
Recruiting in the Digital Age: A Social Media Masterclass
Recruiting in the Digital Age: A Social Media MasterclassRecruiting in the Digital Age: A Social Media Masterclass
Recruiting in the Digital Age: A Social Media Masterclass
 
Agency Managed Advisory Board As a Solution To Career Path Defining Business ...
Agency Managed Advisory Board As a Solution To Career Path Defining Business ...Agency Managed Advisory Board As a Solution To Career Path Defining Business ...
Agency Managed Advisory Board As a Solution To Career Path Defining Business ...
 
ModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
ModelingMarketingStrategiesMKS.CollumbiaUniversitypdfModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
ModelingMarketingStrategiesMKS.CollumbiaUniversitypdf
 

Cis247 a ilab 4 composition and class interfaces

  • 1. CIS247A iLab 4 Composition and Class Interfaces Click this link to get the tutorial: http://homeworkfox.com/tutorials/general- questions/4463/cis247a-ilab-4-composition- and-class-interfaces/ Week 4: Designing Using Objects - iLab Print This Page iLab 4 of 6: Composition and Class Interfaces/Abstract Class Connect to the iLab here. 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.) iLAB OVERVIEW 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: 1. Create a Benefits class. 2. Integrate the Benefit class into the Employee class. 3. Create an iEmployee abstract class to guarantee that calculatePay is implemented in the Employee class. A tutorial on interfaces can be downloaded here.
  • 2. Deliverables Due this week: Capture the Console output window and paste it into a Word document. Zip the project folder files. Put the zip file and screen shots (Word document that contains programming code and screen shots of program output) in the Dropbox. iLAB STEPS STEP 1: Understand the UML Diagram Employee - firstName : string - lastName : string - gender : char - dependents : int - annualSalary : double - static numEmployees : int = 0 +benefit : Benefit +Employee() +Employee(in fname : String, in lname : String, in gen : char, in dep : int, in sal : double) +calculatePay() : double +displayEmployee() : void +static getNumEmployees() : int +getFirstName() : string +setFirstName(in name : String) : void +getLastName() : String +setLastName(in name : String) : void +getGender() : char +setGender(in gen : char) : void +getDependents() : int +setDependents(in dep : int) : void +getAnnualSalary() : double +setAnnualSalary(in sal : double) : void +setAnnualSalary(in sal : String) : void <<interface>> Fido : Animal +calculatePay() : double Benefit -healthinsurance : string -lifeinsurance : double -vacation : int +Benefit() +Benefit(in health : string, in life : double, in vacation : int) +displayBenefits() : void +getHealthInsurance() : string +setHealthInsutance(in hins : string) : void +getLifeInsurance() : double +setLifeInsurance(in lifeIns : double) : void +getVacation() : int +setVacation(in vaca : int) : void 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
  • 3. 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 6. 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. STEP 5: Compile and Test
  • 4. When done, compile and run your code. Then, 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. STEP 6: Screen Prints Capture the Console output window and paste it into a Word document. The following is a sample screen print. Screenshot of program output that reads: CIS247CWeek4iLab' CMD.EXE was started with the above path as the current directory. UNC paths are not supported. Defaulting to Windows directory. Welcome to your Object Oriented Program-- Employee ClassCIS247C, Week 4 LabName: Prof.Nana Liu *************** Employee 1 *************** Please enter your First Name Nana Please enter your Last Name Liu Please enter your Gender Female Please enter your Dependents 2 Please enter your Annual Salary 60000 Please enter your Health InsuranceCigna Please enter your Life Insurance1.5 Please enter your Vacation Days21 Employee Information ________________________________________ Name: Nana Liu Gender: F Dependents: 2 Annual Salary: 60000.00 Weekly Salary: 1153.85 Benefit Information ________________________________________ Health Insurance: Cigna Life Insurance: 1.50 Vacation: 21 days --- Number of Employee Object Created --- Number of employees: 1 ************** Employee 2 ************** Employee Information _______________________________________ Name: Mary Noia Gender: F Dependents: 2 Annual Salary: 150000.00 Weekly Salary: 2884.62 Benefit Information _______________________________________ Health Insurance: North West Mutual Life Insurance: 5000000.00 Vacation: 14 days --- Number of Employee Object Created --- Number of employees: 2 The end of the CIS247C Week4 iLab. Press any key to continue... STEP 7: Submit Deliverables Capture the Console output window and paste it into a Word document. Put the zip file and screen shots (Word document that contains programming code and screen shots of program output) in the Dropbox. 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.