23.05.2017 Views

CIS 247 DeVry Entire Course

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> <strong>Entire</strong> <strong>Course</strong><br />

Downloading is very simple, you can download this <strong>Course</strong> here:<br />

http://wiseamerican.us/product/cis-<strong>247</strong>-devry-entire-course/<br />

Or<br />

Contact us at:<br />

SUPPORT@WISEAMERICAN.US<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> <strong>Entire</strong> <strong>Course</strong><br />

<strong>CIS</strong><strong>247</strong><br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 1 Discussion 1 Latest<br />

Object-Oriented Programming (graded)<br />

The Object-Oriented Paradigm supports abstractions through Classes. Classes are software-programming<br />

abstractions; they encapsulate a set of related attributes (data members) and behaviors (methods) while, at the same<br />

time, they hide essential details from their users. Let's look at a specific problem domain, which contains Appliances.<br />

Please try to pick a specific appliance and list its typical attributes and behaviors. As a next step, code a class for the<br />

appliance you choose.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 1 Discussion 2 Latest<br />

Lab Forum (graded)<br />

This discussion concerns programming labs and techniques. Please post any programming questions or hints and tips<br />

that you have concerning this week's programming lab. At a minimum, post at least three notes that highlight the key<br />

programming techniques and/or problems or lessons learned that you experienced with this week's lab.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 2 Discussion 1 Latest<br />

Object Construction (graded)<br />

What do we mean when we say "make sure an object is in a proper state when it is created," and how is this<br />

accomplished in Object-Oriented Programming? Give examples to support your thoughts.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 2 Discussion 2 Latest<br />

Lab Forum (graded)<br />

This discussion concerns programming labs and techniques. Please post any programming questions or hints and tips<br />

that you have concerning this week's programming lab. At a minimum, post at least three notes that highlight the key<br />

programming techniques and/or problems or lessons learned that you experienced with this week's lab.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 3 Discussion 1 Latest<br />

Encapsulation (graded)<br />

Define encapsulation in terms of object-oriented programming and discuss how it relates to data/information hiding.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 3 Discussion 2 Latest<br />

Lab Forum (graded)<br />

This discussion thread is used to discuss the programming labs, techniques, and any questions that you may have.<br />

Post any programming questions or "hints and tips" you have on this week's programming lab. At a minimum, post at


least three notes that highlight the key programming techniques, problems you had with this week's lab, or help for<br />

other students.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 4 Discussion 1 Latest<br />

Identifying Classes (graded)<br />

After we perform the analysis and collect the user requirements, the process of identifying classes begins. How do we<br />

identify classes? How do we decide the responsibilities of each class? Shall a class take more than one responsibility?<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 4 Discussion 2 Latest<br />

Lab Forum (graded)<br />

This discussion thread is used to discuss the programming labs and techniques. Please post any programming<br />

questions or "hints and tips" that you have concerning this week's programming lab. At a minimum, post at least three<br />

notes that highlight the key programming techniques and/or problems you had with this week's lab.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 5 Discussion 1 Latest<br />

Inheritance (graded)<br />

Often, commonalities exist among classes. Objects might have similar but still somewhat different sets of attributes and<br />

operations. What mechanisms can we use to represent different degrees of similarity among entities in Java?<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 5 Discussion 2 Latest<br />

Lab Forum (graded)<br />

This discussion thread is used to discuss the programming labs and techniques. Please post any programming<br />

questions or "hints and tips" that you have concerning this week's programming lab. At a minimum, post at least three<br />

notes that highlight the key programming techniques and/or problems you had with this week's lab.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 6 Discussion 1 Latest<br />

Interfaces and Abstract Classes (graded)<br />

Discuss how interfaces and abstract classes can be used to create subclasses that contain similar attributes and<br />

behaviors.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 6 Discussion 2 Latest<br />

Lab Forum (graded)<br />

This discussion thread is used to discuss the programming labs, techniques, and any questions that you may have.<br />

Post any programming questions or "hints and tips" you have on this week's programming lab. At a minimum, post at<br />

least three notes that highlight the key programming techniques, problems you had with this week's lab, or help for<br />

other students.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 7 Discussion 1 Latest<br />

Self-Documenting Code (graded)<br />

What are your opinions on the assertion in the lecture that programming style has more to do with program readability<br />

than comments? What IS good programming style? What is bad programming style?<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 7 Discussion 2 Latest<br />

Lab Forum (graded)<br />

This discussion thread is used to discuss the programming labs and techniques. Please post any programming<br />

questions or “hints and tips” that you have concerning this week's programming lab. Post at least three notes that<br />

highlight the key programming techniques and/or problems you had with this week's lab.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 1 Quiz Latest


1. Question : (TCO 1) The components of a class are called _____ and _____.<br />

o<br />

o<br />

o<br />

o<br />

elements; objects<br />

attributes; methods<br />

objects; instantiations<br />

properties; descriptions<br />

Question 2. Question : (TCO 1) Which of the following would be the most appropriate choice for a method in a<br />

Cup class?<br />

o<br />

o<br />

o<br />

o<br />

drink()<br />

hot()<br />

break()<br />

color()<br />

Question 3. Question : (TCO 1) Which of the following statements is/are true?<br />

Objects communicate through message passing.<br />

An object must be defined before you can create a class.<br />

The state of an object should not be hidden.<br />

Implementation details should be visible through the interface of a class.<br />

o<br />

o<br />

o<br />

A and C<br />

All are true<br />

None are true<br />

Question 4. Question : (TCO 1) Which of the following would be the most appropriate choice for a data member<br />

in a Screen class?<br />

o<br />

o<br />

o<br />

o<br />

dimensions<br />

turnoff<br />

refresh<br />

activate Screensaver<br />

Question 5. Question : (TCO 1) The property of _____ describes the packaging of state and behavior together<br />

in an object.<br />

o<br />

o<br />

o<br />

o<br />

o<br />

data hiding<br />

abstraction<br />

encapsulation<br />

All of the above<br />

None of the above<br />

Question 6. Question : (TCO 8) Most professional coding standards use _____ for class names.<br />

o<br />

o<br />

o<br />

o<br />

underscores along with all upper case words<br />

Method Class case<br />

no specific naming convention<br />

Pascal case<br />

Question 7. Question : (TCO 1) Examine the ClockType class definition. How many attributes does it contain?<br />

class ClockType { public void setTime(int hour, int min, int sec);<br />

public int getTime();


public void printTime();<br />

private int hr;<br />

public int min;<br />

public int sec; }<br />

o 2<br />

o 3<br />

o 9<br />

o 6<br />

o An average of 5 because (7+3)/2 = 5<br />

Question 8. Question : (TCO 1) Assume we have two classes and have instantiated an object from each class.<br />

How many copies of each class's attributes and methods exist in the instantiated objects?<br />

o<br />

o<br />

o<br />

o<br />

Two copies, one copy of the first class and one of the second<br />

Zero, the objects do not have attributes and methods<br />

Only one copy and both objects share it<br />

None of the above<br />

Question 9. Question : (TCO 1) Both _____ and _____ allow for code reuse and the building of more complex<br />

systems.<br />

o<br />

o<br />

o<br />

o<br />

inheritance; composition<br />

UML diagrams; serialization<br />

messaging; object behaviors<br />

None of the above<br />

Question 10. Question : (TCO 1) Which of the following is a valid statement for a method definition in Java?<br />

o public int computeAverage { return 1; }<br />

o public int computeAverage ( return 1; )<br />

o public int computeAverage () { return 1; };<br />

o public int computeAverage () { return 1; }<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 2 Quiz Latest<br />

1. Question : (TCO 2) Only those class members which are part of the interface of the class should be declared<br />

as _____.<br />

o<br />

o<br />

o<br />

o<br />

open<br />

banned<br />

private<br />

public<br />

Question 2. Question : (TCO 2) A public accessor is usually paired with a public _____ to allow an outside class<br />

to set and retrieve the value of an object's attribute.<br />

o<br />

o<br />

o<br />

o<br />

constructor<br />

mutator<br />

getter<br />

None of the above


Question 3. Question : (TCO 2) Which of the following statements is/are true?<br />

o<br />

o<br />

o<br />

o<br />

o<br />

If a method is public, it is considered part of the class implementation.<br />

If you declare an attribute as private, you do not have to worry about tracking down every piece of code that<br />

might have changed the attribute when debugging.<br />

While designing a class you add as many interfaces as possible, trying to cover all possible future user needs.<br />

All of the above<br />

None of the above<br />

Question 4. Question : (TCO 2) A Waiter is responsible for taking the order from the Customer based on the<br />

menu, informing the Chef of the order, and delivering the requested food back to the Customer. A Chef is responsible<br />

for preparing the food, while the Customer is responsible for placing an order from the menu. In identifying the interface<br />

of the Waiter object, which of the following would you consider as (an) appropriate message(s) the Waiter should<br />

respond to:<br />

o<br />

o<br />

o<br />

o<br />

o<br />

“Please bring me chicken soup”<br />

“Can you tell me how to make macaroni and cheese?”<br />

“How many hours do you work?”<br />

All of the above<br />

Only A and B<br />

Question 5. Question : (TCO 5) The purpose of a(n) _____ is to initialize the object's data members when an<br />

object is instantiated.<br />

o<br />

o<br />

o<br />

o<br />

method<br />

constructor<br />

class<br />

destructor<br />

Question 6. Question : (TCO 5) Which of the following method pairs are not examples of method overloading?<br />

o public void roll() ; public int move(int x)<br />

o public int charge(int x) ; public int charge(int y)<br />

o public int subtract() ; public void subtract()<br />

o All of the above<br />

o Only B<br />

Question 7. Question : (TCO 5) Consider the following class definition.<br />

public class Rose { private int petals; private double cost; public Rose() { petals = 30; cost = 0.0; }<br />

public Rose(int p) { petals = p; cost = 0.0; } public int getPetals() { return petals; }<br />

public void setCost(int amount) { cost = amount; } } Which of the following are true?<br />

(i) The attribute cost can be set to a new value, by a user of this class.<br />

(ii) System.out.println ("The rose has: " + Rose.getPetals()); is a valid statement.<br />

(iii) There are overloaded constructors in the class. i. ii<br />

o<br />

o<br />

o<br />

Only i and iii<br />

None are true<br />

All are true<br />

Question 8. Question : (TCO 2) Assume a class has a data member called 'color'. Can another class have a<br />

data member called 'color'?<br />

o<br />

Yes, as long as the data member is used in the same way.


o<br />

o<br />

o<br />

No, this is not possible because the compiler would not know which data member to use.<br />

Yes, but only if the classes are not in the same namespace.<br />

None of the above<br />

Question 9. Question : (TCO 5) Which error handling technique is the least appropriate when developing an<br />

application?<br />

o<br />

o<br />

o<br />

o<br />

Check for potential problems and abort the application when a problem is encountered.<br />

Check for potential problems and throw an exception.<br />

Check for potential problems, catch the mistake and try to fix it.<br />

Ignore the problem; all applications crash at some point.<br />

Question 10. Question : (TCO 2) Which is an appropriate choice for a static (or otherwise called class) attribute<br />

in a Building class?<br />

o<br />

o<br />

o<br />

o<br />

Number Of Buildings<br />

Number Of Apartments<br />

Number Of Floors<br />

None of the above<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 3 Quiz Latest<br />

1. Question : (TCO 2) Which of the following statements is/are true?<br />

o<br />

o<br />

o<br />

o<br />

o<br />

Object names are listed in the middle section of a UML diagram.<br />

Attribute names are listed in the middle section of a UML diagram.<br />

Method names are listed in the middle section of a UML diagram.<br />

Class names are listed in the middle section of a UML diagram.<br />

None of the above<br />

Question 2. Question : (TCO 2) Java, C#, and C++ all allow for the use of comments. Which of the following<br />

statements are true regarding comments?<br />

o<br />

o<br />

o<br />

o<br />

o<br />

o<br />

The compiler will ignore all comments if they are properly formatted.<br />

The IDE will ignore all comments if they are properly formatted.<br />

The output console will ignore all comments<br />

if they are properly formatted.<br />

All of the above<br />

None of the above<br />

Question 3. Question : (TCO 2) Attributes represent the _____ of an object because they store information about<br />

that object.<br />

o<br />

o<br />

o<br />

o<br />

state<br />

behaviors<br />

size<br />

accessibility<br />

Question 4. Question : (TCO 2) If a programmer does not explicitly define a(n) _____, a default version will be<br />

provided by the compiler.<br />

o<br />

o<br />

o<br />

destructor<br />

method<br />

constructor


o<br />

o<br />

attribute<br />

All of the above<br />

Question 5. Question : (TCO 2) One of the ways object-oriented languages protect object data is through _____.<br />

o<br />

o<br />

o<br />

o<br />

o<br />

integration of objects<br />

universal data access<br />

the public accessor<br />

encapsulation<br />

All of the above<br />

Question 6. Question : (TCO 2) Which of the following symbols indicate(s) level of access for both attributes and<br />

methods in a class.<br />

o +<br />

o *<br />

o ++<br />

o &<br />

o All of the above<br />

Question 7. Question : (TCO 2) Object-oriented classes should be designed with the concept of a black box in<br />

mind. This means that users of the class should only need to know what _____ and _____ are associated with the<br />

class. The actual implementation details need not be known.<br />

o<br />

o<br />

o<br />

o<br />

interface; implementation<br />

inputs; outputs<br />

objects; accessors<br />

relationships; interfaces<br />

Question 8. Question : (TCO 2) One of the benefits of _____ is that it allows the implementation of a class to<br />

change without affecting external entities using that class.<br />

o<br />

o<br />

o<br />

o<br />

abstraction<br />

encapsulation<br />

instantiation<br />

construction<br />

Question 9. Question : (TCO 2) Which of the following is a proper implementation for a getter?<br />

o<br />

o<br />

o<br />

o<br />

int getAge() { return age;}<br />

void getAge() {return age;}<br />

int getAge(int newAge) {this.age = newAge;}<br />

void getAge() {return age;}<br />

Question 10. Question : (TCO 2) Identify the attribute declaration(s) below that most likely contribute to the<br />

concept of information/data hiding.<br />

o<br />

o<br />

o<br />

o<br />

o<br />

private string name;<br />

private name;<br />

string private name;<br />

string name;<br />

None of the above


<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 4 Quiz Latest<br />

1. Question : (TCO 3) Which statement is true regarding the principles of an object-oriented language?<br />

o<br />

o<br />

o<br />

o<br />

Persistence is not an optional object-oriented language requirement.<br />

All methods should be public when declare inside a class.<br />

Encapsulation means hiding data in a class from other classes.<br />

Class attributes should be global so all elements of the program can see them.<br />

Question 2. Question : (TCO 3) When would a programmer write more than one constructor?<br />

o<br />

o<br />

o<br />

o<br />

You never have more than one constructor<br />

The constructor cannot be overloaded<br />

So objects can be treated the same way as variables of built in data types<br />

None of the above<br />

Question 3. Question : (TCO 3) Which of the following might be potential class(es) in an application?<br />

o<br />

o<br />

o<br />

o<br />

o<br />

Checking Account<br />

Customer<br />

Deposit<br />

A and B<br />

None of the above<br />

Question 4. Question : (TCO 3) Why do classes need to collaborate with each other?<br />

o<br />

o<br />

o<br />

o<br />

Most classes do not exist in isolation.<br />

Classes need to interact with other classes to exchange data.<br />

None of the above<br />

Both A and B<br />

Question 5. Question : (TCO 3) Assume you have an Employee class with a non-static attribute named salary.<br />

If you create ten objects of this class, how many copies of the salary variable will you have?<br />

o 2<br />

o 10<br />

o An unlimited number<br />

o None of the above<br />

Question 6. Question : (TCO 3) What does SOW stands for in the object-oriented design process?<br />

o<br />

o<br />

o<br />

o<br />

Sequence of work<br />

Structure of work<br />

Statement of work<br />

None of the above<br />

Question 7. Question : (TCO 3) In the object-oriented design process, which of the following is true?<br />

o The cost of a design change in the implementation phase is very low.<br />

o The cost of a requirement/design change in the design phase is very high.<br />

o The cost of a design change after the deployment phase is astronomical .<br />

o All of the above<br />

o None of the above<br />

Question 8. Question : (TCO 3) To _____ an object is to create it.


o<br />

o<br />

o<br />

o<br />

instantiate<br />

encapsulate<br />

abstract<br />

overload<br />

Question 9. Question : (TCO 3) Every object of the same class _____.<br />

o<br />

o<br />

o<br />

o<br />

gets a copy of every instance variable only<br />

gets a copy of every instance variable and method<br />

gets a copy of every method only<br />

None of the above<br />

Question 10. Question : (TCO 3) Classes do not have the ability to _____.<br />

o<br />

o<br />

o<br />

o<br />

encapsulate data.<br />

enforce information hiding<br />

contain both data and functions<br />

know how other classes are implemented<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 5 Quiz Latest<br />

1. Question : (TCO 3) Which of the following is/are the mechanism(s) for code reuse?<br />

o<br />

o<br />

o<br />

o<br />

Inheritance<br />

Composition<br />

Inheritance and composition<br />

None of the above<br />

Question 2. Question : (TCO 4) Which of the following is true about inheritance?<br />

o<br />

o<br />

o<br />

o<br />

Child classes are more generalized than their associated parent classes.<br />

Inheritance demonstrates the generalization/specialization relationship.<br />

Parent classes are more specialized than their associated child classes.<br />

Parent classes contains more functionality than child classes.<br />

Question 3. Question : (TCO 4) Select the parent class.<br />

o<br />

o<br />

o<br />

o<br />

Barking Dog<br />

Yodeling Dog<br />

Golden Retriever<br />

Dog<br />

Question 4. Question : (TCO 4) Which of the following is not a good example of a hierarchy that could be<br />

modeled by inheritance?<br />

o<br />

o<br />

o<br />

o<br />

Airplanes<br />

Geometric shapes<br />

Animals<br />

Prime numbers<br />

Question 5. Question : (TCO 4) Which of the following examples represent(s) the “is-a” relationship in the<br />

parent/child format?


o<br />

o<br />

o<br />

o<br />

dog/cat<br />

rectangle/circle<br />

checking account/saving account<br />

None of the above<br />

Question 6. Question : (TCO 3) What is/are the reason(s) to use inheritance?<br />

o<br />

o<br />

o<br />

o<br />

Labor division<br />

Introducing modularity into program<br />

Reusing design<br />

All of the above<br />

Question 7. Question : (TCO 3) If class B is inherited from class A, which of the following statements is true?<br />

o Class A has access to the methods and fields of class B.<br />

o Class A has access to the methods and fields of class B and class B's subclasses.<br />

o Class B does not have access to the methods and fields of class A.<br />

o Class B has access to the methods and fields of class A.<br />

Question 8. Question : (TCO 4) Which accessibility modifier is most general?<br />

o<br />

o<br />

o<br />

o<br />

Private<br />

Default<br />

Public<br />

Protected<br />

Question 9. Question : (TCO 4) Which of the following refers to a class that inherits from a parent class?<br />

o<br />

o<br />

o<br />

o<br />

Child classes<br />

Derived classes<br />

Subclass classes<br />

All of the above<br />

Question 10. Question : (TCO 6) Which of the following are benefits of using inheritance?<br />

o<br />

o<br />

o<br />

o<br />

Smaller chance of errors<br />

Ease of use for users of class<br />

Time saving<br />

All of the above<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 6 Quiz Latest<br />

1. Question : (TCO 7) An instance of an abstract class can be created using _____.<br />

o<br />

o<br />

o<br />

o<br />

the new operator<br />

encapsulation<br />

a public accessor<br />

None of the above<br />

Question 2. Question : (TCO 7) An abstract _____ is used only to form related subclasses using inheritance<br />

since it cannot be instantiated.<br />

o<br />

method


o<br />

o<br />

o<br />

class<br />

object<br />

attribute<br />

Question 3. Question : (TCO 7) Which of the following statements is false?<br />

o<br />

o<br />

o<br />

o<br />

An abstract method is a method signature without a method body and can be found in an abstract class.<br />

If a subclass extends an abstract base class, the subclass must implement the abstract method(s) from the<br />

base class, or else call itself abstract also.<br />

Any method in an abstract class is considered an abstract method.<br />

Abstract methods are inherited.<br />

Question 4. Question : (TCO 7) Which of the following classes is most likely an abstract class?<br />

o<br />

o<br />

o<br />

o<br />

Vehicle<br />

Blue Spruce<br />

Hand Saw<br />

Goldfish<br />

Question 5. Question : (TCO 7) In terms of object-oriented programming, a(n) _____ is a mechanism that forces<br />

a programmer to adhere to specific rules when developing an application.<br />

o<br />

o<br />

o<br />

o<br />

o<br />

contract<br />

base class<br />

requirements analysis<br />

method signature<br />

None of the above<br />

Question 6. Question : (TCO 7) _____ and _____ can contain abstract methods.<br />

o<br />

o<br />

o<br />

o<br />

Abstract classes; base classes<br />

Abstract classes; interfaces<br />

Interfaces; base classes<br />

None of the above<br />

Question 7. Question : (TCO 7) Multiple inheritance is defined as the ability to do what?<br />

o<br />

o<br />

o<br />

o<br />

Identify multiple superclasses for a single class<br />

Create multiple subclasses from a single superclass<br />

Override multiple methods in a base class<br />

Overload multiple superclasses for a single class<br />

Question 8. Question : (TCO 7) Which of the following class definitions defines a legal abstract class?<br />

o class abstract Dog { void grow(); }<br />

o public abstract class Dog { void eat (){} }<br />

o abstract private class Dog { void eat (); }<br />

o public class abstract Dog { void eat (){} }<br />

Question 9. Question : (TCO 7) Which of the following declares an abstract method in an abstract Java class?<br />

o public abstract calc();<br />

o public abstract void calc();<br />

o public void calc() {}<br />

o public void abstract calc();


Question 10. Question : (TCO 7) Which of the following statements is true?<br />

o Interfaces contain a list of already implemented methods.<br />

o Interfaces contain a list of pre-defined attributes with default values .<br />

o All methods defined in an interface must be implemented by any class that chooses to implement the interface.<br />

o At least one of the methods defined in an interface must be implemented by any class that chooses to<br />

implement the interface.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 1 iLab Latest<br />

iLab 1 of 7: Creating a User Interface<br />

iLAB OVERVIEW<br />

Scenario and Summary<br />

This program creates the basic user interface code that can be used in the following weeks' iLab assignments. The<br />

assignment will help you get started using the programming environment and some practice with coding. You will also<br />

be able to reuse much, if not all, of the code in later assignments.<br />

In this program, you will create the following methods:<br />

1. Display Application Information, which will provide the program user some basic information about the<br />

program.<br />

2. Display Divider, which will provide a meaningful output separator between different sections of the program<br />

output.<br />

3. Get Input, which is a generalized function that will prompt the user for a specific type of information, then return<br />

the string representation of the user input.<br />

4. Terminate Application, which provides a program termination message and then terminates the application.<br />

Using these methods, you will construct a program that prompts the user for the following:<br />

1. his or her name, which will be a string data type;<br />

2. his or her age, which will be an integer data type;<br />

3. the gas mileage for the user's car, which will be a double data type; and<br />

4. a display of the collected information.<br />

Also, note that the program should contain a well-documented program header.<br />

Deliverables<br />

Step<br />

Step 4<br />

Step 5<br />

Deliverable<br />

Screen shot of running program results<br />

Zip file with entire Lab files<br />

Preparation:<br />

If you are using the Citrix remote lab, follow the login instructions located in the iLab tab in <strong>Course</strong> Home. Launch your<br />

integrated development environment (IDE) to begin.<br />

iLAB STEPS<br />

STEP 1: Review the Design


.equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa-d30418a01912/1/<strong>CIS</strong><strong>247</strong>B_W1_iLab.html#top">Back to Top<br />

Download the program description and pseudocode. Make sure you fully understand the program design and ask any<br />

questions that you may have BEFORE you start programming.<br />

Click.equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa-d30418a01912/1/documents--<br />

cis<strong>247</strong>B_wk1_design.pdf">Week 1 Lab Designto download program design.<br />

STEP 2: Construct the Program<br />

.equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa-d30418a01912/1/<strong>CIS</strong><strong>247</strong>B_W1_iLab.html#top">Back to Top<br />

1. Create a new project titled "<strong>CIS</strong><strong>247</strong>B_WK1_Lab_LASTNAME".<br />

2. Using the Week 1 Lab Design document to construct the methods.<br />

3. Once the methods are constructed, use the Week 1 Lab Design document to create the main program.<br />

STEP 3: Compile and Test<br />

.equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa-d30418a01912/1/<strong>CIS</strong><strong>247</strong>B_W1_iLab.html#top">Back to Top<br />

o<br />

o<br />

When done, ensure that there are no compilation errors. If there are errors, open up the Error list and fix all<br />

listed errors.<br />

Execute your code and check your output to ensure that you have the desired output. If you need to fix<br />

anything, close your execution window, modify your code as necessary, and rebuild.<br />

STEP 4: Screen Prints<br />

.equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa-d30418a01912/1/<strong>CIS</strong><strong>247</strong>B_W1_iLab.html#top">Back to Top<br />

o<br />

o<br />

Capture a screen shot of your application's output and paste it into a Word document.<br />

The output of your code should resemble the following:<br />

STEP 5: Submit Deliverables<br />

.equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa-d30418a01912/1/<strong>CIS</strong><strong>247</strong>B_W1_iLab.html#top">Back to Top<br />

o<br />

o<br />

Put all of the project files into a zip file.<br />

Put the zip file and screen shots (Word document) in the Dropbox.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 2 iLab Latest<br />

iLab 2 of 7: Employee Class<br />

Remember This! .devry.edu/vpn/index.html">Connect to the iLab here.<br />

Note! Submit your assignment to the Dropbox located on the silver tab at the top of this page. (See the Syllabus section<br />

"Due Dates for Assignments & Exams" for due dates.)<br />

iLAB OVERVIEW<br />

Scenario and Summary<br />

We begin our investigation of object-oriented programming by creating an object-oriented program with a class called<br />

Employee. You will create two objects based on the Employee class, along with a class that contains the main method.<br />

The attributes, constructors, and methods for this class must satisfy the requirements in Steps 1 through 3. After you<br />

create the objects, you will prompt the user for information and then display it.<br />

We will want to ensure that this first class is well-constructed and tested since we will extend this class in Labs 3 through<br />

6.


Deliverables<br />

Due this week:<br />

Capture the Console output window and paste it into a Word document.<br />

Zip the project folder files.<br />

Put the zip file and screen shots (Word document that contains programming code and screen shots of program output)<br />

in the Dropbox.<br />

iLAB STEPS<br />

STEP 1: Understand the UML Class Diagram<br />

.equella.ecollege.com/file/6eeabc50-43d2-410a-9a6f-a74f918a92f7/1/<strong>CIS</strong><strong>247</strong>B_W2_iLab.html#top">Back to Top<br />

Use the following UML diagram to build the class. The first section specifies the attributes. The second section specifies<br />

the behaviors, and the first character specifies the access modifier value, where:<br />

o<br />

o<br />

"-" means that the class member is private, and<br />

"+" means that the class member is public.<br />

STEP 2: Code the Employee Class<br />

.equella.ecollege.com/file/6eeabc50-43d2-410a-9a6f-a74f918a92f7/1/<strong>CIS</strong><strong>247</strong>B_W2_iLab.html#top">Back to Top<br />

1. Create a new project called "<strong>CIS</strong><strong>247</strong>B_WK2_Lab_LASTNAME".<br />

2. Using the provided Class Diagram from Step 1, code the Employee class in the new project (i.e., "Realize the UML<br />

Class diagrams").<br />

3. The default constructor should set the attributes as follows:<br />

o firstName = "not given"<br />

o lastName = "not given"<br />

o gender = "U" (for unknown)<br />

o dependents = 0<br />

o annualSalary = 20,000<br />

4. The multi-arg constructor should initialize all of the attributes using values passed in using its parameter list.<br />

5. As shown in the Class diagram, each attribute should have a "getter" to retrieve the stored attribute value, and a<br />

"setter" that modifies the value.<br />

6. The calculatePay( ) method of the Employee class should return the value of annual salary divided by 52 (return<br />

annualSalary / 52;).<br />

7. The displayEmployee() method should display all the attributes of the Employee object in a well-formatted string with<br />

logical labels applied to each attribute. Don't forget to call calculatePay from within the displayEmployee method in<br />

order to display the Employee's weekly pay as well!<br />

8. Inside displayEmployee, create a NumberFormat object for currency with the following:<br />

9. Display the pay with the following:<br />

STEP 3: Code the Main Program<br />

.equella.ecollege.com/file/6eeabc50-43d2-410a-9a6f-a74f918a92f7/1/<strong>CIS</strong><strong>247</strong>B_W2_iLab.html#top">Back to Top<br />

In the Main class, create code statements that perform the following operations. Be sure you follow proper commenting<br />

and programming styles (header, indentation, line spacing, etc.).<br />

1. Create an Employee object using the default constructor.


2. Prompt for and then set the first name, last name, gender, dependents, and annual salary. (Remember that you have<br />

to convert gender, dependents, and annual salary from strings to the appropriate data type.)<br />

3. Using your code from last week, display a divider that contains the string "Employee Information"<br />

4. Display the Employee information.<br />

5. Create a second Employee object using the multi-argument constructor, setting each of the attributes with<br />

appropriate valid values.<br />

6. Using your code from last week, display a divider that contains the string "Employee Information".<br />

7. Display the Employee information for the second Employee object.<br />

STEP 4: Compile and Test<br />

.equella.ecollege.com/file/6eeabc50-43d2-410a-9a6f-a74f918a92f7/1/<strong>CIS</strong><strong>247</strong>B_W2_iLab.html#top">Back to Top<br />

When done, compile and run your code. Then, debug any errors until your code is error-free.<br />

Check your output to ensure that you have the desired output, modify your code as necessary, and rebuild.<br />

Your output should resemble the following:<br />

STEP 5: Submit Deliverables<br />

.equella.ecollege.com/file/6eeabc50-43d2-410a-9a6f-a74f918a92f7/1/<strong>CIS</strong><strong>247</strong>B_W2_iLab.html#top">Back to Top<br />

o<br />

o<br />

Capture the Console output window and paste into a Word document.<br />

Put the zip file and screen shots (Word document) in the Dropbox.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 3 iLab Latest<br />

iLab 3 of 7: Overloaded Methods and Static Methods / Variables<br />

iLAB OVERVIEW<br />

Scenario and Summary<br />

The objective of the lab is to take the UML Class diagram and enhance last week's Employee class by making the<br />

following changes:<br />

1. Create a static variable called numEmployees that holds an int and initialize it to zero. This will allow us to count all<br />

the Employee objects created in the main class.<br />

2. Increment numEmployees in all of the constructors<br />

3. Add overloaded versions of setDependents and setAnnualSalary that accept strings. This way, we will have two "set"<br />

methods for both dependents and annual salary; one that accepts a string, and one that accepts its default data type.<br />

Deliverables<br />

Due this week:<br />

o<br />

o<br />

o<br />

Capture the Console output window and paste it into a Word document.<br />

Zip the project folder files.<br />

Put the zip file and screen shots (Word document that contains programming code and screen shots of<br />

program output) in the Dropbox.<br />

iLAB STEPS<br />

STEP 1: Understand the UML Diagram<br />

.equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/<strong>CIS</strong><strong>247</strong>B_W3_iLab.html#top">Back to Top


The following attribute has been added:<br />

- static numEmployees: int = 0<br />

The following behaviors have been added:<br />

+ static getNumEmployees( ) : int<br />

+ setDependents(in dep : String) : void<br />

+ setAnnualSalary(in sal : String) : void<br />

STEP 2: Create the Project<br />

.equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/<strong>CIS</strong><strong>247</strong>B_W3_iLab.html#top">Back to Top<br />

You will want to use the Week 2 project as the starting point for the lab. To do this, you will want to create a new project<br />

by following these steps:<br />

1. Open the same workspace you created for the Week 2 project.<br />

2. Create a new project named "<strong>CIS</strong><strong>247</strong>B_WK3_Lab_LASTNAME". An empty project will then be created.<br />

3. Copy your main class and employee class files from Week 2 and paste them into the Week 3 project.<br />

4. Before you move on to the next step, build and execute the Week 3 project.<br />

For each week's assignments, you will follow these steps create a new project that reuses the program from the<br />

previous week.<br />

STEP 3: Modify the Employee<br />

.equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/<strong>CIS</strong><strong>247</strong>B_W3_iLab.html#top">Back to Top<br />

Using the UML Diagrams from Step 1, code the changes to the Employee class.<br />

a. Create a static numEmployees variable and initialize it to zero.<br />

b. Increment numEmployees by 1 in each of the constructors.<br />

c. Create an overloaded setDependents method and, this time, make the parameter a string.<br />

d. Create an overloaded setAnnualSalary method and, this time, make the parameter a string. Remember that you<br />

will have to convert the string in the above two "set" methods to the data type of the attribute.<br />

e. Make the getNumEmployees a static method. (This way, you can call it with the class name instead of an object<br />

name.)<br />

Be sure you follow proper commenting and programming styles (indentation, line spacing, etc.).<br />

STEP 4: Modify the Main Method<br />

.equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/<strong>CIS</strong><strong>247</strong>B_W3_iLab.html#top">Back to Top<br />

In the Main class, create code statements that perform the following operations. Be sure you follow proper commenting<br />

and programming styles (header, indentation, line spacing, etc.).<br />

Note that several of the steps below were accomplished in last week's assignment. New steps are in bold.<br />

1. Create an Employee object using the default constructor.<br />

2. Prompt for and then set the first name, last name, and gender. Consider using your getInput method from Week 1<br />

to obtain data from the user for this step as well as Step 3.<br />

3. Prompt for and then set dependents and annual salary using the new overloaded setters.<br />

4. Using your code from Week 1, display a divider that contains the string "Employee Information".<br />

5. Display the Employee Information.


6. Display the number of employees created using getNumEmployees. Remember to access getNumEmployees using<br />

the class name, not the Employee object.<br />

7. Create a second Employee object using the multi-arg constructor, setting each of the attributes with the following<br />

values: "Mary", "Noia", 'F', 5, 24000.0<br />

8. Using your code from Week 1, display a divider that contains the string "Employee Information".<br />

9. Display the employee information for the second Employee object.<br />

10. Display the number of employees created using getNumEmployees. Remember to access getNumEmployees<br />

using the class name, not the Employee object.<br />

STEP 5: Compile and Test<br />

.equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/<strong>CIS</strong><strong>247</strong>B_W3_iLab.html#top">Back to Top<br />

When done, compile and run your code. Debug any errors until your code is error-free.<br />

Check your output to ensure that you have the desired output, modify your code as necessary, and rebuild.<br />

Your output should resemble the following:<br />

STEP 6: Submit Deliverables<br />

.equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/<strong>CIS</strong><strong>247</strong>B_W3_iLab.html#top">Back to Top<br />

o<br />

o<br />

Capture the output window and paste it into a Word document.<br />

Put the zip file and screen shots (Word document) in the Dropbox.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 4 iLab Latest<br />

iLab 4 of 7: Composition and Class Interfaces<br />

Scenario and Summary<br />

The objective of the lab is to modify the Employee class to demonstrate composition and a class interface. An employee<br />

typically has benefits, so we will make the following changes:<br />

1. Create a Benefits class.<br />

2. Integrate the Benefit class into the Employee class.<br />

3. Create an iEmployee abstract class to guarantee that calculatePay is implemented in the Employee class. A tutorial<br />

on interfaces can be downloaded.equella.ecollege.com/file/99187c60-80a4-48a0-b203-0544f90accd2/1/documents--<br />

Interfaces_Java.docx">here.<br />

Deliverables<br />

Due this week:<br />

o<br />

o<br />

o<br />

Capture the Console output window and paste it into a Word document.<br />

Zip the project folder files.<br />

Put the zip file and screen shots (Word document that contains programming code and screen shots of<br />

program output) in the Dropbox.<br />

iLAB STEPS<br />

STEP 1: Understand the UML Diagram<br />

.equella.ecollege.com/file/99187c60-80a4-48a0-b203-0544f90accd2/1/<strong>CIS</strong><strong>247</strong>B_W4_iLab.html#top">Back to Top<br />

The only change to the Employee class is that there is a new attribute:


+benefit : Benefit<br />

Notice that there is a "+" for this attribute, meaning that it is public. Make sure to examine the multi-arg constructor's<br />

signature!<br />

Also, the dotted directed line between Employee and iEmployee specifies that the Employee class must implement the<br />

iEmployee abstract class, and thus provide an implementation for the calculatePay method.<br />

STEP 2: Create the Project<br />

.equella.ecollege.com/file/99187c60-80a4-48a0-b203-0544f90accd2/1/<strong>CIS</strong><strong>247</strong>B_W4_iLab.html#top">Back to Top<br />

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<br />

by following these steps:<br />

1. Open the same workspace you created for the Week 3 project.<br />

2. Create a new project and name it "<strong>CIS</strong><strong>247</strong>B_WK4_Lab_LASTNAME".<br />

3. Copy all the source files from the Week 3 project into the Week 4 project.<br />

4. Before you move on to the next step, build and execute the Week 4 project.<br />

STEP 3: Modify the Employee Class<br />

.equella.ecollege.com/file/99187c60-80a4-48a0-b203-0544f90accd2/1/<strong>CIS</strong><strong>247</strong>B_W4_iLab.html#top">Back to Top<br />

1. Using the UML Diagrams from Step 1, create the Benefit class. To get an idea of how to format displayBenefits, take<br />

a look at the output in Step 5.<br />

2. Add a Benefit attribute to the Employee class.<br />

3. Initialize the new Benefit attribute in both Employee constructors. Again, take note of the multi-arg constructors<br />

parameter list!<br />

4. Create the iEmployee interface.<br />

5. Modify the Employee class to implement the new interface so that Employee will have to implement the calculatePay<br />

method.<br />

6. Modify the Employee class to call displayBenefit when displaying Employee information.<br />

STEP 4: Modify the Main Method<br />

.equella.ecollege.com/file/99187c60-80a4-48a0-b203-0544f90accd2/1/<strong>CIS</strong><strong>247</strong>B_W4_iLab.html#top">Back to Top<br />

Notice that the Employee class now has a public benefit object inside it. This means that you can access the set<br />

methods of the Benefit object with the following code:<br />

.benefit.<br />

As an example, to set the lifeInsurance attribute inside an Employee object called emp, we could execute the following<br />

code:<br />

emp.benefit.setLifeInsurance(lifeInsurance);<br />

The steps required to modify the Main class are below.<br />

1. Create an Employee object using the default constructor.<br />

2. Prompt for and then set the first name, last name, and gender. Consider using your getInput method from Week 1<br />

to obtain data from the user for this step as well as Step 3.<br />

3. Prompt for and then set the dependents and annual salary using the overloaded setters that accept Strings.<br />

4. Prompt for and set healthInsurance, lifeInsurance, and vacation.<br />

5. Using your code from Week 1, display a divider that contains the string "Employee Information".<br />

6. Display the Employee Information.


7. Display the number of employees created using getNumEmployees(). Remember to access getNumEmployees<br />

using the class name, not the Employee object.<br />

8. Create a Benefit object called benefit1 using the multi-arg constructor. Use any information you want for health<br />

insurance, life insurance, and vacation.<br />

9. Create another Employee object and use the constructor to fill it with the following: "Mary", "Noia", 'F', 5, 24000.0,<br />

benefit1<br />

10. Using your code from Week 1, display a divider that contains the string "Employee Information".<br />

11. Display the employee information.<br />

12. Display the number of employees created using getNumEmployees(). Remember to access getNumEmployees<br />

using the class name, not the Employee object.<br />

STEP 5: Compile and Test<br />

.equella.ecollege.com/file/99187c60-80a4-48a0-b203-0544f90accd2/1/<strong>CIS</strong><strong>247</strong>B_W4_iLab.html#top">Back to Top<br />

When done, compile and execute your code. Debug any errors until your code is error-free.<br />

Check your output to ensure that you have the desired output, modify your code as necessary, and rebuild.<br />

Your output should resemble the following:<br />

STEP 6: Submit Deliverables<br />

.equella.ecollege.com/file/99187c60-80a4-48a0-b203-0544f90accd2/1/<strong>CIS</strong><strong>247</strong>B_W4_iLab.html#top">Back to Top<br />

Capture the Console output window and paste it into a Word document.<br />

Put the zip file and screen shots (Word document) in the Dropbox.<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 5 iLab Latest<br />

iLab 5 of 7: Inheritance<br />

iLAB OVERVIEW<br />

Scenario and Summary<br />

The objective of the lab is to take the UML Class diagram and enhance last week's Employee class by making the<br />

following changes:<br />

1. Create a class called Salaried that is derived from Employee.<br />

2. Create a class called Hourly that is also derived from Employee.<br />

3. Since all classes/objects inherit from java.lang.object class, change the "displayClass" information method to override<br />

the java.lang.object "toString" method.<br />

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

Deliverables<br />

Due this week:<br />

o<br />

o<br />

o<br />

Capture the console output window and paste into a Word document.<br />

Zip the project folder file.<br />

Put the zip file and screenshots (Word document) in the Dropbox.<br />

iLAB STEPS


STEP 1: Understand the UML Diagram<br />

Notice the change in UML diagram. It is common practice to leave out the accessors and mutators (getters and setters)<br />

from UML class diagrams, since there can be so many of them. Unless otherwise specified, it isassumedthat there is<br />

an accessor (getter) and a mutator (setter) for every class attribute.<br />

STEP 2: Create the Project<br />

Before you move on to the next step, build and execute the Week 5 project.Create a new project and name it<br />

<strong>CIS</strong><strong>247</strong>B_WK5_Lab_LASTNAME. Copy all the source files from the Week 4 project into the Week 5 project.<br />

STEP 3: Modify the Benefits Class<br />

Change the displayBenefits method to override the java.lang.object toString method by simply changing its name from<br />

displayBenefits to toString.All classes that are contained in Java's API as well as any external classes that you or I may<br />

create are derived from the java.lang.object class. The Object class contains several methods which are inherited by<br />

all other Java classes. One of these methods is called toString. The toString method can be overridden by any class<br />

and its purpose is to display an object’s current state. This type of functionality should sound familiar to you. After all,<br />

your displayBenefits method was designed to print the current state of a Benefit object! In this week's lab, we are going<br />

to move the logic contained in displayBenefits to the toString method.<br />

Take a look at Java’s description of the toString method contained in<br />

the.oracle.com/javase/6/docs/api/java/lang/Object.html">Objectclass and pay particular attention to its return type<br />

before moving on.<br />

1. Ensure the toString method returns a String and does not explicitly display the state information to the console.<br />

Remember, toString does not display information but instead it simply returns a string.<br />

STEP 4: Modify the Employee Class<br />

Using the updated Employee class diagram, modify attributes to be protected as necessary.Java provides three explicit<br />

access modifiers for attributes and methods. So far, we have dealt with two of them: public and private. This week, we<br />

will use a new access modifier: protected. Java states that "The protected modifier specifies that the member can only<br />

be accessed within its own package (as with package-private) and, in addition, by a subclass of its class in another<br />

package." For additional information on the use of protected as an access modifier, review the<br />

1. Change the name of the displayEmployee method to "toString" and modify the new toString method to return an<br />

Employee's information as a String. This overrides the java.lang.object toString method.<br />

2. Delete the iEmployee interface class, and remove the reference from the Employee class.<br />

STEP 5: Create the Salaried Class<br />

In this step, it is necessary to implement constant attributes. As the name implies, constants contain values that do not<br />

change. In Java, an attribute is made into a constant by adding the keywords "static final" in the declaration. For<br />

additional information on the creation and use of constants, review the<br />

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

access parent-defined attributes and methods within a subclass. A common practice is to use the code super() or<br />

super(arg-list) to invoke the constructor in a parent class. For additional information on the use of super in your<br />

application and specifically this week’s constructors, review the<br />

1. Using the UML Diagrams from Step 1, create the Salaried classes, ensuring to specify that the Salary class inherits<br />

from the Employee class.<br />

2. For each of the constructors listed in the Salaried class, ensure to invoke the appropriate superclass constructor and<br />

pass the correct arguments to the superclass constructor. This will initialize the protected attributes and update the<br />

numEmployees counter. Don’t forget to initialize the attributes for Salaried as well!<br />

3. The valid management levels are 0, 1, 2, and 3, and the min and max management level attributes should be<br />

implemented as constants. Make sure to enforce this set of valid values in the management level setter.<br />

4. Override the calculatePay method to add a 10 percent bonus to the annual salary for each of the management levels<br />

(i.e., bonus percentage = managementLevel * BONUS_PERCENT). The bonus percentage should be implemented as<br />

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<br />

Employee's toString method to capture the state of the inherited Employee attributes!<br />

STEP 6: Create the Hourly Class<br />

STEP 7: Construct the Main Method<br />

Using the UML Diagrams from Step 1,<br />

1. Create the Hourly class, ensuring to specify that the Hourly class inherits from the Employee class.<br />

2. For each of the constructors listed in the Hourly class, ensure to invoke the appropriate base class constructor and<br />

pass the correct arguments to the base class constructor. This will initialize the protected attributes and update the<br />

numEmployees counter.<br />

3. The valid category types are "temporary", "part time", and "full time". (Hint: The use of String.equalsIgnoreCase may<br />

be useful when setting the value of category. Search through Java's API for more details on the use of<br />

equalsIgnoreCase.)<br />

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<br />

as constants.<br />

5. The provided wage must be between 10 and 75 inclusive, and the limits should be implemented as constants.<br />

6. Make sure to update the value of annualSalary appropriately every time the value of wage or hours changes.<br />

Remember, an Hourly employee's annual salary is calculated using the following formula: wage * hours * 52. Therefore,<br />

any change to wage or hours will affect the employee's annual salary!<br />

7. Override the toString method to add the category to the hourly employee information.<br />

STEP 8: Compile and Test<br />

Using previous weeks' assignments as an example, create at least one Employee, Hourly, and Salaried employee.<br />

1. For each object created, write statements to exercise each of the public methods listed in the class diagram.<br />

2. For each object created, invoke the object's toString method to display the employee's information.<br />

3. For each object created, display the number of employees created.<br />

Check your output to ensure that you have the desired output, modify your code as necessary, and rebuild. When done,<br />

compile and execute your code, and debug any errors until your code is error-free.<br />

Your output should resemble the following. Make sure to fully exercise all of your new and overridden subclass methods.<br />

This could result in output that is lengthier than the example below.<br />

STEP 9: Submit Deliverables<br />

Capture the console output window and paste it into a Word document.<br />

o<br />

Put the zip file and screenshots (Word document) in the Dropbox.<br />

Submit your lab to the Dropbox located on the silver tab at the top of this page. For instructions on how to use the<br />

Dropbox, read these.next.ecollege.com/default/launch.ed?ssoType=DVUHubSSO2&node=184">step-by-step<br />

instructions<br />

<strong>CIS</strong> <strong>247</strong> <strong>DeVry</strong> Week 6 iLab Latest<br />

iLab 6 of 7: Abstract Class and Polymorphism<br />

iLAB OVERVIEW<br />

Scenario and Summary


We have two separate goals this week:<br />

1. We are going to create an abstract Employee class and an abstract calculatePay method. The abstract Employee<br />

class will prevent a programmer from creating an object based on Employee. Only objects based on Salaried and<br />

Hourly will be allowed. The abstract calculatePay method in Employee will force the child classes to implement<br />

calculatePay.<br />

2. We are going to implement Polymorphism and dynamic binding by creating generalized methods that accept<br />

generalized Employee objects to collect input and display information. However, in the main method we will pass<br />

derived objects of the Employee class into the methods.<br />

Deliverables<br />

Due this week:<br />

o<br />

o<br />

o<br />

Capture the console output window and paste it into a Word document.<br />

Zip the project files.<br />

Put the zip file and screenshots (Word document) in the Dropbox.<br />

iLAB STEPS<br />

STEP 1: Understand the UML Diagram .<br />

equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/<strong>CIS</strong><strong>247</strong>B_W6_iLab.html#top">Back to Top<br />

Notice in the updated UML diagram that the Employee class is designated asabstractby having the class<br />

nameEmployeeitalicized. Also, thecalculatePaymethod is italicized, which means that it is an abstract method and<br />

needs to be implemented in the derived classes.<br />

STEP 2: Create the Project<br />

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/<strong>CIS</strong><strong>247</strong>B_W6_iLab.html#top">Back to Top<br />

Create a new project and name it <strong>CIS</strong><strong>247</strong>B_WK6_Lab_LASTNAME. Copy all the source files from the Week 5 project<br />

into the Week 6 project.<br />

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

STEP 3: Modify the Employee Class<br />

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/<strong>CIS</strong><strong>247</strong>B_W6_iLab.html#top">Back to Top<br />

1. Make the Employee class abstract.<br />

2. Define calculatePay as an abstract method.<br />

STEP 4: Modify the Hourly Class<br />

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/<strong>CIS</strong><strong>247</strong>B_W6_iLab.html#top">Back to Top<br />

Implement the calculatePay method. Since calculatePay is not declared as an abstract method in Employee, all<br />

subclasses of Employee must provide an implementation for calculatePay. Unlike the Salaried class, the Hourly class<br />

does not currently have an implementation for calculatePay and this will cause an error!<br />

STEP 5: Modify the Main Class - Create Generalized Input Methods<br />

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/<strong>CIS</strong><strong>247</strong>B_W6_iLab.html#top">Back to Top<br />

In your Main class, create a method called collectEmployeeInformation that accepts as an argument an Employee<br />

object and prompts the user for all the employee attributes, retrieves the attributes, makes any necessary conversions,<br />

and then sets the attribute value in the object. Remember you may pass both Salaried and Hourly objects into this<br />

method. Therefore it will be necessary to determine which type of object you are deal with, at runtime, using the<br />

getClass method. The following is an example of how you might use the getClass method:<br />

Once you have determined the type of object you are dealing with, you will also need to cast that object to the correct<br />

type in order to access its class-specific methods. In order to cast a general Employee object to a Salaried object and<br />

access one of its class-specific methods, you would do the following:


(Salaried)employee).methodInSalariedClass;<br />

We are also going to implement error handing this week using a try/catch block. Specifically, you should wrap the code<br />

used to acquire and set the life insurance amount and vacation days in try-catch blocks as shown below. The "try"<br />

portion of the code looks for an error. If an error occurs parsing the integer, it jumps down to the "catch" portion of the<br />

code and displays the error message. Because badInput is still true, it loops back to the "do" and starts over. Once the<br />

integer is parsed correctly, badInput is set to false so it exits the loop and correctly sets the value for vacation.<br />

STEP 6: Modify the Main Class - Create a Display Employee Information<br />

.equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/<strong>CIS</strong><strong>247</strong>B_W6_iLab.html#top">Back to Top<br />

Create a method called displayEmployeeInformation that accepts an Employee object, provides an output header<br />

string, and then displays Empl

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!