cis 247 devry week 5 ilab latest n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
CIS 247 DEVRY WEEK 5 ILAB LATEST PowerPoint Presentation
Download Presentation
CIS 247 DEVRY WEEK 5 ILAB LATEST

Loading in 2 Seconds...

play fullscreen
1 / 5

CIS 247 DEVRY WEEK 5 ILAB LATEST - PowerPoint PPT Presentation


  • 0 Views
  • Uploaded on

\nVisit Below Link, To Download This Course:\n\nhttps://www.tutorialsservice.net/product/cis-247-devry-week-5-ilab-latest/\n\nOr \nEmail us on\nSUPPORT@TUTORIALSSERVICE.NET\n\nCIS 247 DeVry Week 5 iLab Latest\nCIS247\nCIS 247 DeVry Week 5 iLab Latest\niLab 5 of 7: Inheritance\niLAB OVERVIEW\nScenario and Summary\nThe objective of the lab is to take the UML Class diagram and enhance last week’s Employee class by making the following changes:\n1. Create a class called Salaried that is derived from Employee.\n2. Create a class called Hourly that is also derived from Employee.\n

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'CIS 247 DEVRY WEEK 5 ILAB LATEST' - tutorialsservicesnet


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
cis 247 devry week 5 ilab latest

CIS 247 DEVRY WEEK 5 ILAB LATEST

Visit Below Link, To Download This Course:

https://www.tutorialsservice.net/product/cis-247-devry-week-5-ilab-latest/

Or

Email us on

SUPPORT@TUTORIALSSERVICE.NET

CIS 247 DeVry Week 5 iLab Latest

CIS247

CIS 247 DeVry Week 5 iLab Latest

iLab 5 of 7: Inheritance

iLAB OVERVIEW

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. Since all classes/objects inherit from java.lang.object class, change the “displayClass” information

method to override the java.lang.object “toString” method.

4. Override necessary method(s) in each of the new subclasses as applicable.

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 steps

iLAB STEPS

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 isassumedthat there is an accessor (getter) and a mutator (setter) for every class attribute.

STEP 2: Create the Project

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

name it CIS247B_WK5_Lab_LASTNAME. Copy all the source files from the Week 4 project into the

Week 5 project.

STEP 3: Modify the Benefits Class

Change the displayBenefits method to override the java.lang.object toString method by simply changing

its name from displayBenefits to toString.All classes that are contained in Java’s API as well as any

external classes that you or I may create are derived from the java.lang.object class. The Object class

contains several methods which are inherited by all other Java classes. One of these methods is called

toString. The toString method can be overridden by any class and its purpose is to display an object’s

current state. This type of functionality should sound familiar to you. After all, your displayBenefits method

was designed to print the current state of a Benefit object! In this week’s lab, we are going to move the

logic contained in displayBenefits to the toString method.

Take a look at Java’s description of the toString method contained in

the.oracle.com/javase/6/docs/api/java/lang/Object.html”>Objectclass and pay particular attention to its

return type before moving on.

1. Ensure the toString method returns a String and does not explicitly display the state information to the

console. Remember, toString does not display information but instead it simply returns a string.

STEP 4: Modify the Employee Class

Using the updated Employee class diagram, modify attributes to be protected as necessary.Java provides

three explicit access modifiers for attributes and methods. So far, we have dealt with two of them: public

and private. This week, we will use a new access modifier: protected. Java states that “The protected

modifier specifies that the member can only be accessed within its own package (as with package-

private and in addition by a subclass

private) and, in addition, by a subclass of its class in another package.” For additional information on the

use of protected as an access modifier, review the

1. Change the name of the displayEmployee method to “toString” and modify the new toString method to

return an Employee’s information as a String. This overrides the java.lang.object toString method.

2. Delete the iEmployee interface class, and remove the reference from the Employee class.

STEP 5: Create the Salaried Class

In this step, it is necessary to implement constant attributes. As the name implies, constants contain

values that do not change. In Java, an attribute is made into a constant by adding the keywords “static

final” in the declaration. For additional information on the creation and use of constants, review the

One other very important concept to review for this step in the lab is the use of the super method. Super

is used to access parent-defined attributes and methods within a subclass. A common practice is to use

the code super() or super(arg-list) to invoke the constructor in a parent class. For additional information

on the use of super in your application and specifically this week’s constructors, review the

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 superclass

constructor and pass the correct arguments to the superclass constructor. This will initialize the protected

attributes and update the numEmployees counter. Don’t forget to initialize the attributes for Salaried as

well!

3. The valid management levels are 0, 1, 2, and 3, and the min and max management level attributes

should be implemented as constants. Make sure to enforce this set of valid values in the management

level setter.

4. Override the calculatePay method to add a 10 percent bonus to the annual salary for each of the

management levels (i.e., bonus percentage = managementLevel * BONUS_PERCENT). The bonus

percentage should be implemented as a constant. Also remember, the value returned from calculatePay

should be equal to an employee’s weekly pay.

5. Override the toString method to add the management level to the employee information. Don’t forget to

call Employee’s toString method to capture the state of the inherited Employee attributes!

STEP 6: Create the Hourly Class

step 7 construct the main method

STEP 7: Construct the Main Method

Using the UML Diagrams from Step 1,

1. Create the Hourly class, 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”. (Hint: The use of

String.equalsIgnoreCase may be useful when setting the value of category. Search through Java’s API

for more details on the use of equalsIgnoreCase.)

4. The value for hours must be greater than or equal to 0 and less than or equal to 50. The limits should

be implemented as constants.

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

constants.

6. Make sure to update the value of annualSalary appropriately every time the value of wage or hours

changes. Remember, an Hourly employee’s annual salary is calculated using the following formula: wage

* hours * 52. Therefore, any change to wage or hours will affect the employee’s annual salary!

7. Override the toString method to add the category to the hourly employee information.

STEP 8: Compile and Test

Using previous weeks’ assignments as an example, create at least one Employee, Hourly, and Salaried

employee.

1. For each object created, write statements to exercise each of the public methods listed in the class

diagram.

2. For each object created, invoke the object’s toString method to display the employee’s information.

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

Check your output to ensure that you have the desired output, modify your code as necessary, and

rebuild. When done, compile and execute your code, and debug any errors until your code is error-free.

your output should resemble the following make

Your output should resemble the following. Make sure to fully exercise all of your new and overridden

subclass methods. This could result in output that is lengthier than the example below.

STEP 9: Submit Deliverables

Capture the console output window and paste it 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.next.ecollege.com/default/launch.ed?ssoType=DVUHubSSO2&node=184″>step-by-step

instructions