SlideShare a Scribd company logo
1 of 5
CIS247A iLab 5 Inheritance

Click this link to get the tutorial:
http://homeworkfox.com/tutorials/general-
questions/4464/cis247a-ilab-5-inheritance/
Week 5: Composition, Inheritance, and Polymorphism - iLab

                                                                                               Print This



                                                                                                   Page



iLab 5 of 6: Inheritance



                                      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 OVERVIE
 W
Scenario and Summary

The objective of the lab is to take the UML Class diagram and enhance last week's Employee class by
making the following changes:

   1. Create a class called Salaried that is derived from Employee.
   2. Create a class called Hourly that is also derived from Employee.

   3. Override the base class calculatePay() method.

   4. Override the displayEmployee() method.

Deliverables

Due this week:
•    Capture the Console output window and paste into a Word document.
     •    Zip the project folder file.

     •    Put the zip file and screenshots (Word document) in the Dropbox.

 iLAB STEP
 S
STEP 1: Understand the UML Diagram

Notice the change in UML diagram. It is common practice to leave out the accessors and mutators
(getters and setters) from UML class diagrams, since there can be so many of them. Unless otherwise
specified, it is assumed that there is an accessor (getter) and a mutator (setter) for every class attribute.




Employee #firstName : string #lastName : string #gender : char #dependents : int #annualSalary : double #benefit : Benefit
-static numEmployees : int = 0 +Employee() +Employee(in fname : string, in lname : string, in gen : char, in dep : int, in
benefits : Benefit) +static getNumEmployees() : int +CalculatePay() : double +displayEmployee() : void Benefit
-healthinsurance : string -lifeinsurance : double -vacation : int +Benefit() +Benefit(in hins : string, in lins : double, in vac : int)
+displayBenefits() : void Salaried -MIN_MANAGEMENT_LEVEL : int = 0 -MAX_MANAGEMENT_LEVEL : int = 3
-BONUS_PERCENT : double = 10 -managementLevel : int +Salaried() +Salaried(in fname : string, in lname : string, in gen :
char, in dep : int, in sal : double, in ben : Benefit, in manLevel : int) +Salaried(in sal : double, in manLevel : int)
+CalculatePay() : double +displayEmployee() : void Hourly -MIN_WAGE : double = 10 -MAX_WAGE : double = 75
-MIN_HOURS : double = 0 -MAX_HOURS: double = 50 -wage : double -hours : double -category : string +Hourly()
+Hourly(in wage : double, in hours : double, in category : string) +Hourly(in fname : string, in lname : string, in gen : char, in
dep : int, in wage : double, in hours : double, in ben : Benefit, in category : string) +CalculatePay() : double
+displayEmployee() : void
STEP 2: Create the Project

Create a new project and name it CIS247C_WK5_Lab_LASTNAME. Copy all the source files from the
Week 4 project into the Week 5 project.

Before you move on to the next step, build and execute the Week 5 project.


STEP 3: Modify the Employee Class
   1. Using the updated Employee class diagram, modify the attributes to be protected.
   2. Delete the iEmployee interface class, and remove the reference from the Employee class.


STEP 4: Create the Salaried Class
   1. Using the UML Diagrams from Step 1, create the Salaried classes, ensuring to specify that the
      Salary class inherits from the Employee class.

     2. For each of the constructors listed in the Salaried class, ensure to invoke the appropriate base
        class constructor and pass the correct arguments to the base class constructor. This will initialize
        the protected attributes and update the numEmployees counter.

     3. The valid management levels are 0, 1, 2, and 3, and should be implemented as a constant.

     4. Override the calculatePay method to add a 10 percent bonus for each of the management levels
        (i.e., bonus percentage = managementLevel * .10). The bonus percentage should be
        implemented as a constant.
5. Override the displayEmployee() method to add the management level to the employee
       information.


STEP 5: Label Title
   1. Using the UML Diagrams from Step 1, create the Hourly classes, ensuring to specify that the
      Hourly class inherits from the Employee class.

    2. For each of the constructors listed in the Hourly class, ensure to invoke the appropriate base
       class constructor and pass the correct arguments to the base class constructor. This will initialize
       the protected attributes and update the numEmployees counter.

    3. The valid category types are "temporary", "part time", and "full time".

    4. The provided hours must be more than 0 hours and less than 50 hours, and the limits should be
       implemented as constants.

    5. The provided wage must be between 10 and 75, and the limits should be implemented as
       constants.

    6. Override the calculatePay method by multiplying the wages by the number of hours.

    7. Override the Employee setAnnualSalary method and set the annual salary by multiplying the
       weekly pay by 50.

    8. Override the displayEmployee() method to add the category to the hourly employee information.


STEP 6: Label Title
   1. Using previous weeks' assignments as an example, create at least one Employee, Hourly, and
      Salaried employee.

    2. For each object created, display the number of employees created.

    3. For each object created, write statements to exercise each of the public methods listed in the
       Class diagram.

    4. For each object created, invoke the object's displayEmployee() method to display the employee's
       information.

    5. For employee, the following information needs to be displayed:

                                           Partial Sample output




Screenshot of program output that reads: Employee Information ________________________________________ Name:
Nana Liu Gender: F Annual Salary: 60000.00 Weekly Salary: 1153.85 Benefit Information
________________________________________ Health Insurance: PPO Life Insurance: 1.50 Vacation: 20 days ---
Number of Employee Object Created --- Number of employees: 1
    6. For salaried employee, the following information needs to be displayed:

                                           Partial Sample output
Screenshot of program output that reads: Name: Jackie Chan Gender: M Dependents: 1 Annual Salary: 50000.00 Weekly
Salary: 1250.00 Benefit Information ________________________________________ Health Insurance: HMO Life
Insurance: 100.00 Vacation: 16 days Salaried Employee Management Level: 3 --- Number of Employee Object Created ---
Number of employees: 2
    7. For hourly employee, the following information needs to be displayed:

                                               Partial Sample output




Screenshot of program output that reads: Name: James Bond Gender: M Dependents: 0 Annual Salary: 100000.00 Weekly
Salary: 2000.00 Benefit Information ________________________________________ Health Insurance: PPO Life
Insurance: 5.00 Vacation: 17 days Hourly Employee Category: Unknown Wage: 40.00 Hours: 50.00 --- Number of Employee
Object Created --- Number of employees: 3
STEP 7: 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.

Below is the complete sample program output for your reference.




Screenshot of program output that reads: ************** 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 HealthInsurancePPO Please enter your LifeInsurance1.5 Please enter your Vacation
Days20 Employee Information ________________________________________ Name: Nana Liu Gender: F Annual Salary:
60000.00 Weekly Salary: 1153.85 Benefit Information ________________________________________ Health Insurance:
PPO Life Insurance: 1.50 Vacation: 20 days --- Number of Employee Object Created --- Number of employees: 1
************** Employee 2 ************** Please enter your First Name Jackie Please enter your Last Name Chan Please enter
your Gender Male Please enter your Dependents 1 Please enter your HealthInsuranceHMO Please enter your
LifeInsurance100 Please enter your Vacation Days16 Employee Information
________________________________________ Name: Jackie Chan Gender: M Dependents: 1 Annual Salary: 50000.00
Weekly Salary: 1250.00 Benefit Information ________________________________________ Health Insurance: HMO Life
Insurance: 100.00 Vacation: 16 days Salaried Employee Management Level: 3 --- Number of Employee Object Created ---
Number of employees: 2 *************** Employee 3 *************** Please enter your First Name James Please enter your
Last Name Bond Please enter your Gender Male Please enter your Dependents 0 Please enter your Health InsurancePPO
Please enter your Life InsurancePPO Please enter your Vacation Days17 Employee Information
_______________________________________ Name: James Bond Gender: M Dependents: 0 Annual Salary: 100000.00
Weekly Salary: 2000.00 Benefit Information ________________________________________ Health Insurance: PPO Life
Insurance: 5.00 Vacation: 17 days Hourly Employee Category: Unknown Wage: 40.00 Hours: 50.00 --- Number of Employee
Object Created --- Number of employees: 3 The end of the CIS247C Week 5 iLab. Press any key to continue...
STEP 8: Label Title
    •    Capture the Console output window and paste into a Word document.
    •    Put the zip file and screenshots (Word document) 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

Similar to Cis247 a ilab 5 inheritance

Cis247 i lab 4 composition and class interfaces
Cis247 i lab 4 composition and class interfacesCis247 i lab 4 composition and class interfaces
Cis247 i lab 4 composition and class interfacessdjdskjd9097
 
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 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 classcis247
 
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 variablescis247
 
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 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 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
 
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.docxgilbertkpeters11344
 
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.docxssuser562afc1
 
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.docxlorindajamieson
 
Itco 620 unit 5 project
Itco 620 unit 5 projectItco 620 unit 5 project
Itco 620 unit 5 projectcomp274
 
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.docxemelyvalg9
 
Looks like the questions has been ask before but isnt answered cor.pdf
Looks like the questions has been ask before but isnt answered cor.pdfLooks like the questions has been ask before but isnt answered cor.pdf
Looks like the questions has been ask before but isnt answered cor.pdfbadshetoms
 
Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7ashhadiqbal
 
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
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universitylhkslkdh89009
 
Prg 420 entire course
Prg 420 entire coursePrg 420 entire course
Prg 420 entire coursePRG420
 

Similar to Cis247 a ilab 5 inheritance (20)

Cis247 i lab 4 composition and class interfaces
Cis247 i lab 4 composition and class interfacesCis247 i lab 4 composition and class interfaces
Cis247 i lab 4 composition and class interfaces
 
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 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 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 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 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 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
 
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
 
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
 
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
 
Itco 620 unit 5 project
Itco 620 unit 5 projectItco 620 unit 5 project
Itco 620 unit 5 project
 
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
 
Looks like the questions has been ask before but isnt answered cor.pdf
Looks like the questions has been ask before but isnt answered cor.pdfLooks like the questions has been ask before but isnt answered cor.pdf
Looks like the questions has been ask before but isnt answered cor.pdf
 
Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7Comp 220 ilab 3 of 7
Comp 220 ilab 3 of 7
 
Hr erpnext
Hr erpnextHr erpnext
Hr erpnext
 
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
 
Comp 220 lab 3
Comp 220 lab 3Comp 220 lab 3
Comp 220 lab 3
 
Cis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry universityCis407 a ilab 6 web application development devry university
Cis407 a ilab 6 web application development devry university
 
Prg 420 entire course
Prg 420 entire coursePrg 420 entire course
Prg 420 entire course
 

Recently uploaded

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 

Recently uploaded (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 

Cis247 a ilab 5 inheritance

  • 1. CIS247A iLab 5 Inheritance Click this link to get the tutorial: http://homeworkfox.com/tutorials/general- questions/4464/cis247a-ilab-5-inheritance/ Week 5: Composition, Inheritance, and Polymorphism - iLab Print This Page iLab 5 of 6: Inheritance 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 OVERVIE W Scenario and Summary The objective of the lab is to take the UML Class diagram and enhance last week's Employee class by making the following changes: 1. Create a class called Salaried that is derived from Employee. 2. Create a class called Hourly that is also derived from Employee. 3. Override the base class calculatePay() method. 4. Override the displayEmployee() method. Deliverables Due this week:
  • 2. Capture the Console output window and paste into a Word document. • Zip the project folder file. • Put the zip file and screenshots (Word document) in the Dropbox. iLAB STEP S STEP 1: Understand the UML Diagram Notice the change in UML diagram. It is common practice to leave out the accessors and mutators (getters and setters) from UML class diagrams, since there can be so many of them. Unless otherwise specified, it is assumed that there is an accessor (getter) and a mutator (setter) for every class attribute. Employee #firstName : string #lastName : string #gender : char #dependents : int #annualSalary : double #benefit : Benefit -static numEmployees : int = 0 +Employee() +Employee(in fname : string, in lname : string, in gen : char, in dep : int, in benefits : Benefit) +static getNumEmployees() : int +CalculatePay() : double +displayEmployee() : void Benefit -healthinsurance : string -lifeinsurance : double -vacation : int +Benefit() +Benefit(in hins : string, in lins : double, in vac : int) +displayBenefits() : void Salaried -MIN_MANAGEMENT_LEVEL : int = 0 -MAX_MANAGEMENT_LEVEL : int = 3 -BONUS_PERCENT : double = 10 -managementLevel : int +Salaried() +Salaried(in fname : string, in lname : string, in gen : char, in dep : int, in sal : double, in ben : Benefit, in manLevel : int) +Salaried(in sal : double, in manLevel : int) +CalculatePay() : double +displayEmployee() : void Hourly -MIN_WAGE : double = 10 -MAX_WAGE : double = 75 -MIN_HOURS : double = 0 -MAX_HOURS: double = 50 -wage : double -hours : double -category : string +Hourly() +Hourly(in wage : double, in hours : double, in category : string) +Hourly(in fname : string, in lname : string, in gen : char, in dep : int, in wage : double, in hours : double, in ben : Benefit, in category : string) +CalculatePay() : double +displayEmployee() : void STEP 2: Create the Project Create a new project and name it CIS247C_WK5_Lab_LASTNAME. Copy all the source files from the Week 4 project into the Week 5 project. Before you move on to the next step, build and execute the Week 5 project. STEP 3: Modify the Employee Class 1. Using the updated Employee class diagram, modify the attributes to be protected. 2. Delete the iEmployee interface class, and remove the reference from the Employee class. STEP 4: Create the Salaried Class 1. Using the UML Diagrams from Step 1, create the Salaried classes, ensuring to specify that the Salary class inherits from the Employee class. 2. For each of the constructors listed in the Salaried class, ensure to invoke the appropriate base class constructor and pass the correct arguments to the base class constructor. This will initialize the protected attributes and update the numEmployees counter. 3. The valid management levels are 0, 1, 2, and 3, and should be implemented as a constant. 4. Override the calculatePay method to add a 10 percent bonus for each of the management levels (i.e., bonus percentage = managementLevel * .10). The bonus percentage should be implemented as a constant.
  • 3. 5. Override the displayEmployee() method to add the management level to the employee information. STEP 5: Label Title 1. Using the UML Diagrams from Step 1, create the Hourly classes, ensuring to specify that the Hourly class inherits from the Employee class. 2. For each of the constructors listed in the Hourly class, ensure to invoke the appropriate base class constructor and pass the correct arguments to the base class constructor. This will initialize the protected attributes and update the numEmployees counter. 3. The valid category types are "temporary", "part time", and "full time". 4. The provided hours must be more than 0 hours and less than 50 hours, and the limits should be implemented as constants. 5. The provided wage must be between 10 and 75, and the limits should be implemented as constants. 6. Override the calculatePay method by multiplying the wages by the number of hours. 7. Override the Employee setAnnualSalary method and set the annual salary by multiplying the weekly pay by 50. 8. Override the displayEmployee() method to add the category to the hourly employee information. STEP 6: Label Title 1. Using previous weeks' assignments as an example, create at least one Employee, Hourly, and Salaried employee. 2. For each object created, display the number of employees created. 3. For each object created, write statements to exercise each of the public methods listed in the Class diagram. 4. For each object created, invoke the object's displayEmployee() method to display the employee's information. 5. For employee, the following information needs to be displayed: Partial Sample output Screenshot of program output that reads: Employee Information ________________________________________ Name: Nana Liu Gender: F Annual Salary: 60000.00 Weekly Salary: 1153.85 Benefit Information ________________________________________ Health Insurance: PPO Life Insurance: 1.50 Vacation: 20 days --- Number of Employee Object Created --- Number of employees: 1 6. For salaried employee, the following information needs to be displayed: Partial Sample output
  • 4. Screenshot of program output that reads: Name: Jackie Chan Gender: M Dependents: 1 Annual Salary: 50000.00 Weekly Salary: 1250.00 Benefit Information ________________________________________ Health Insurance: HMO Life Insurance: 100.00 Vacation: 16 days Salaried Employee Management Level: 3 --- Number of Employee Object Created --- Number of employees: 2 7. For hourly employee, the following information needs to be displayed: Partial Sample output Screenshot of program output that reads: Name: James Bond Gender: M Dependents: 0 Annual Salary: 100000.00 Weekly Salary: 2000.00 Benefit Information ________________________________________ Health Insurance: PPO Life Insurance: 5.00 Vacation: 17 days Hourly Employee Category: Unknown Wage: 40.00 Hours: 50.00 --- Number of Employee Object Created --- Number of employees: 3 STEP 7: 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. Below is the complete sample program output for your reference. Screenshot of program output that reads: ************** 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 HealthInsurancePPO Please enter your LifeInsurance1.5 Please enter your Vacation Days20 Employee Information ________________________________________ Name: Nana Liu Gender: F Annual Salary: 60000.00 Weekly Salary: 1153.85 Benefit Information ________________________________________ Health Insurance: PPO Life Insurance: 1.50 Vacation: 20 days --- Number of Employee Object Created --- Number of employees: 1 ************** Employee 2 ************** Please enter your First Name Jackie Please enter your Last Name Chan Please enter your Gender Male Please enter your Dependents 1 Please enter your HealthInsuranceHMO Please enter your LifeInsurance100 Please enter your Vacation Days16 Employee Information ________________________________________ Name: Jackie Chan Gender: M Dependents: 1 Annual Salary: 50000.00 Weekly Salary: 1250.00 Benefit Information ________________________________________ Health Insurance: HMO Life Insurance: 100.00 Vacation: 16 days Salaried Employee Management Level: 3 --- Number of Employee Object Created --- Number of employees: 2 *************** Employee 3 *************** Please enter your First Name James Please enter your Last Name Bond Please enter your Gender Male Please enter your Dependents 0 Please enter your Health InsurancePPO Please enter your Life InsurancePPO Please enter your Vacation Days17 Employee Information _______________________________________ Name: James Bond Gender: M Dependents: 0 Annual Salary: 100000.00 Weekly Salary: 2000.00 Benefit Information ________________________________________ Health Insurance: PPO Life Insurance: 5.00 Vacation: 17 days Hourly Employee Category: Unknown Wage: 40.00 Hours: 50.00 --- Number of Employee Object Created --- Number of employees: 3 The end of the CIS247C Week 5 iLab. Press any key to continue... STEP 8: Label Title • Capture the Console output window and paste into a Word document. • Put the zip file and screenshots (Word document) 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.
  • 5. See Syllabus "Due Dates for Assignments & Exams" for due date information.