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

Loading in 2 Seconds...

play fullscreen
1 / 4

CIS 247 DEVRY WEEK 6 ILAB LATEST - PowerPoint PPT Presentation


  • 3 Views
  • Uploaded on

\nVisit Below Link, To Download This Course:\n\nhttps://www.tutorialsservice.net/product/cis-247-devry-week-6-ilab-latest/\n\nOr \nEmail us on\nSUPPORT@TUTORIALSSERVICE.NET\n\nCIS 247 DeVry Week 6 iLab Latest\nCIS247\nCIS 247 DeVry Week 6 iLab Latest\niLab 6 of 7: Abstract Class and Polymorphism\niLAB OVERVIEW\nScenario and Summary\nWe have two separate goals this week:\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 6 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 6 ilab latest

CIS 247 DEVRY WEEK 6 ILAB LATEST

Visit Below Link, To Download This Course:

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

Or

Email us on

SUPPORT@TUTORIALSSERVICE.NET

CIS 247 DeVry Week 6 iLab Latest

CIS247

CIS 247 DeVry Week 6 iLab Latest

iLab 6 of 7: Abstract Class and Polymorphism

iLAB OVERVIEW

Scenario and Summary

We have two separate goals this week:

1. We are going to create an abstract Employee class and an abstract calculatePay method. The abstract

Employee class will prevent a programmer from creating an object based on Employee. Only objects

based on Salaried and Hourly will be allowed. The abstract calculatePay method in Employee will force

the child classes to implement calculatePay.

2. We are going to implement Polymorphism and dynamic binding by creating generalized methods that

accept generalized Employee objects to collect input and display information. However, in the main

method we will pass derived objects of the Employee class into the methods.

Deliverables

Due this week:

Capture the console output window and paste it into a Word document.

Zip the project files.

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

ilab steps

iLAB STEPS

STEP 1: Understand the UML Diagram .

equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/CIS247B_W6_iLab.html#top”>Back

to Top

Notice in the updated UML diagram that the Employee class is designated asabstractby having the class

nameEmployeeitalicized. Also, thecalculatePaymethod is italicized, which means that it is an abstract

method and needs to be implemented in the derived classes.

STEP 2: Create the Project

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/CIS247B_W6_iLab.html#top”>Back

to Top

Create a new project and name it CIS247B_WK6_Lab_LASTNAME. Copy all the source files from the

Week 5 project into the Week 6 project.

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

STEP 3: Modify the Employee Class

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/CIS247B_W6_iLab.html#top”>Back

to Top

1. Make the Employee class abstract.

2. Define calculatePay as an abstract method.

STEP 4: Modify the Hourly Class

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/CIS247B_W6_iLab.html#top”>Back

to Top

Implement the calculatePay method. Since calculatePay is not declared as an abstract method in

Employee, all subclasses of Employee must provide an implementation for calculatePay. Unlike the

Salaried class, the Hourly class does not currently have an implementation for calculatePay and this will

cause an error!

STEP 5: Modify the Main Class – Create Generalized Input Methods

equella ecollege com file 2164b3b4 af98 4f45 b574

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/CIS247B_W6_iLab.html#top”>Back

to Top

In your Main class, create a method called collectEmployeeInformation that accepts as an argument an

Employee object and prompts the user for all the employee attributes, retrieves the attributes, makes any

necessary conversions, and then sets the attribute value in the object. Remember you may pass both

Salaried and Hourly objects into this method. Therefore it will be necessary to determine which type of

object you are deal with, at runtime, using the getClass method. The following is an example of how you

might use the getClass method:

Once you have determined the type of object you are dealing with, you will also need to cast that object to

the correct type in order to access its class-specific methods. In order to cast a general Employee object

to a Salaried object and access one of its class-specific methods, you would do the following:

(Salaried)employee).methodInSalariedClass;

We are also going to implement error handing this week using a try/catch block. Specifically, you should

wrap the code used to acquire and set the life insurance amount and vacation days in try-catch blocks as

shown below. The “try” portion of the code looks for an error. If an error occurs parsing the integer, it

jumps down to the “catch” portion of the code and displays the error message. Because badInput is still

true, it loops back to the “do” and starts over. Once the integer is parsed correctly, badInput is set to false

so it exits the loop and correctly sets the value for vacation.

STEP 6: Modify the Main Class – Create a Display Employee Information

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/CIS247B_W6_iLab.html#top”>Back

to Top

Create a method called displayEmployeeInformation that accepts an Employee object, provides an output

header string, and then displays Employee information.

STEP 7: Modify the Main Class – Create a Display Number Employee Method

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/CIS247B_W6_iLab.html#top”>Back

to Top

Create a method called displayNumberOfEmployees to display the number of employee objects.

STEP 8: Modify the Main Method

equella ecollege com file 2164b3b4 af98 4f45 b574 1

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/CIS247B_W6_iLab.html#top”>Back

to Top

1. Create an array of employee objects with:Employee employeeList[] = new Employee[2];

2. For the first employeeList index, create a Salaried employee.

3. Call the collectEmployeeInformation method, passing in the Salaried object.

4. Use the displayEmployeeInformation method to display the object’s state.

5. Use the displayNumberEmployees method to display the total number of Employees created.

Remember, this includes both Salaried and Hourly employees.

6. For the second employeeList index, create an Hourly employee.

7. Repeat Steps 3-5 for the Hourly object.

8. As an educational exercise, you can try to create an Employee object to verify that an error will occur.

STEP 9: Compile and Test

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/CIS247B_W6_iLab.html#top”>Back

to Top

When done, compile and execute your code, and 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. All of the output values should match last week’s output.