1 / 33

CIS 247 DEVRY ENTIRE COURSE

<br>Visit Below Link, To Download This Course:<br><br>https://www.tutorialsservice.net/product/cis-247-devry-entire-course/<br><br>Or <br>Email us on<br>SUPPORT@TUTORIALSSERVICE.NET<br><br>CIS 247 DeVry Entire Course<br>CIS247<br>CIS 247 DeVry Week 1 Discussion 1 Latest<br>Object-Oriented Programming (graded)<br>The Object-Oriented Paradigm supports abstractions through Classes. Classes are software-programming abstractions; they encapsulate a set of related attributes (data members) and behaviors (methods) while, at the same time, they hide essential details from their users. Let’s look at a specific problem domain, which contains Appliances. Please try to pick a specific appliance and list its typical attributes and behaviors. As a next step, code a class for the appliance you choose.<br>

Download Presentation

CIS 247 DEVRY ENTIRE COURSE

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CIS 247 DEVRY ENTIRE COURSE Visit Below Link, To Download This Course: https://www.tutorialsservice.net/product/cis-247-devry-entire-course/ Or Email us on SUPPORT@TUTORIALSSERVICE.NET CIS 247 DeVry Entire Course CIS247 CIS 247 DeVry Week 1 Discussion 1 Latest Object-Oriented Programming (graded) The Object-Oriented Paradigm supports abstractions through Classes. Classes are software- programming abstractions; they encapsulate a set of related attributes (data members) and behaviors (methods) while, at the same time, they hide essential details from their users. Let’s look at a specific problem domain, which contains Appliances. Please try to pick a specific appliance and list its typical attributes and behaviors. As a next step, code a class for the appliance you choose. CIS 247 DeVry Week 1 Discussion 2 Latest Lab Forum (graded) This discussion concerns programming labs and techniques. Please post any programming questions or hints and tips that you have concerning this week’s programming lab. At a minimum, post at least three notes that highlight the key programming techniques and/or problems or lessons learned that you experienced with this week’s lab. CIS 247 DeVry Week 2 Discussion 1 Latest Object Construction (graded) What do we mean when we say “make sure an object is in a proper state when it is created,” and how is this accomplished in Object-Oriented Programming? Give examples to support your thoughts.

  2. CIS 247 DeVry Week 2 Discussion 2 Latest Lab Forum (graded) This discussion concerns programming labs and techniques. Please post any programming questions or hints and tips that you have concerning this week’s programming lab. At a minimum, post at least three notes that highlight the key programming techniques and/or problems or lessons learned that you experienced with this week’s lab. CIS 247 DeVry Week 3 Discussion 1 Latest Encapsulation (graded) Define encapsulation in terms of object-oriented programming and discuss how it relates to data/information hiding. CIS 247 DeVry Week 3 Discussion 2 Latest Lab Forum (graded) This discussion thread is used to discuss the programming labs, techniques, and any questions that you may have. 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 other students. CIS 247 DeVry Week 4 Discussion 1 Latest Identifying Classes (graded) After we perform the analysis and collect the user requirements, the process of identifying classes begins. How do we identify classes? How do we decide the responsibilities of each class? Shall a class take more than one responsibility? CIS 247 DeVry Week 4 Discussion 2 Latest Lab Forum (graded) This discussion thread is used to discuss the programming labs and techniques. Please post any programming questions or “hints and tips” that you have concerning this week’s programming lab. At a minimum, post at least three notes that highlight the key programming techniques and/or problems you had with this week’s lab.

  3. CIS 247 DeVry Week 5 Discussion 1 Latest Inheritance (graded) Often, commonalities exist among classes. Objects might have similar but still somewhat different sets of attributes and operations. What mechanisms can we use to represent different degrees of similarity among entities in Java? CIS 247 DeVry Week 5 Discussion 2 Latest Lab Forum (graded) This discussion thread is used to discuss the programming labs and techniques. Please post any programming questions or “hints and tips” that you have concerning this week’s programming lab. At a minimum, post at least three notes that highlight the key programming techniques and/or problems you had with this week’s lab. CIS 247 DeVry Week 6 Discussion 1 Latest Interfaces and Abstract Classes (graded) Discuss how interfaces and abstract classes can be used to create subclasses that contain similar attributes and behaviors. CIS 247 DeVry Week 6 Discussion 2 Latest Lab Forum (graded) This discussion thread is used to discuss the programming labs, techniques, and any questions that you may have. 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 other students. CIS 247 DeVry Week 7 Discussion 1 Latest Self-Documenting Code (graded) What are your opinions on the assertion in the lecture that programming style has more to do with program readability than comments? What IS good programming style? What is bad programming style? CIS 247 DeVry Week 7 Discussion 2 Latest Lab Forum (graded)

  4. This discussion thread is used to discuss the programming labs and techniques. Please post any programming questions or “hints and tips” that you have concerning this week’s programming lab. Post at least three notes that highlight the key programming techniques and/or problems you had with this week’s lab. CIS 247 DeVry Week 1 Quiz Latest 1. Question : (TCO 1) The components of a class are called _____ and _____.     elements; objects attributes; methods objects; instantiations properties; descriptions Question 2. Question : (TCO 1) Which of the following would be the most appropriate choice for a method in a Cup class?     drink() hot() break() color() Question 3. Question : (TCO 1) Which of the following statements is/are true? Objects communicate through message passing. An object must be defined before you can create a class. The state of an object should not be hidden. Implementation details should be visible through the interface of a class.    A and C All are true None are true Question 4. Question : (TCO 1) Which of the following would be the most appropriate choice for a data member in a Screen class?     dimensions turnoff refresh activate Screensaver

  5. Question 5. Question : (TCO 1) The property of _____ describes the packaging of state and behavior together in an object.      data hiding abstraction encapsulation All of the above None of the above Question 6. Question : (TCO 8) Most professional coding standards use _____ for class names.     underscores along with all upper case words Method Class case no specific naming convention Pascal case Question 7. Question : (TCO 1) Examine the ClockType class definition. How many attributes does it contain? class ClockType { public void setTime(int hour, int min, int sec); public int getTime(); public void printTime(); private int hr; public int min; public int sec; }      2 3 9 6 An average of 5 because (7+3)/2 = 5 Question 8. Question : (TCO 1) Assume we have two classes and have instantiated an object from each class. How many copies of each class’s attributes and methods exist in the instantiated objects?     Two copies, one copy of the first class and one of the second Zero, the objects do not have attributes and methods Only one copy and both objects share it None of the above

  6. Question 9. Question : (TCO 1) Both _____ and _____ allow for code reuse and the building of more complex systems.     inheritance; composition UML diagrams; serialization messaging; object behaviors None of the above Question 10. Question : (TCO 1) Which of the following is a valid statement for a method definition in Java?     public int computeAverage { return 1; } public int computeAverage ( return 1; ) public int computeAverage () { return 1; }; public int computeAverage () { return 1; } CIS 247 DeVry Week 2 Quiz Latest 1. Question : (TCO 2) Only those class members which are part of the interface of the class should be declared as _____.     open banned private public Question 2. Question : (TCO 2) A public accessor is usually paired with a public _____ to allow an outside class to set and retrieve the value of an object’s attribute.     constructor mutator getter None of the above Question 3. Question : (TCO 2) Which of the following statements is/are true?   If a method is public, it is considered part of the class implementation. If you declare an attribute as private, you do not have to worry about tracking down every piece of code that might have changed the attribute when debugging. While designing a class you add as many interfaces as possible, trying to cover all possible future user needs. All of the above None of the above   

  7. Question 4. Question : (TCO 2) A Waiter is responsible for taking the order from the Customer based on the menu, informing the Chef of the order, and delivering the requested food back to the Customer. A Chef is responsible for preparing the food, while the Customer is responsible for placing an order from the menu. In identifying the interface of the Waiter object, which of the following would you consider as (an) appropriate message(s) the Waiter should respond to:      “Please bring me chicken soup” “Can you tell me how to make macaroni and cheese?” “How many hours do you work?” All of the above Only A and B Question 5. Question : (TCO 5)The purpose of a(n) _____ is to initialize the object’s data members when an object is instantiated.     method constructor class destructor Question 6. Question : (TCO 5) Which of the following method pairs are not examples of method overloading?      public void roll() ; public int move(int x) public int charge(int x) ; public int charge(int y) public int subtract() ; public void subtract() All of the above Only B Question 7. Question : (TCO 5) Consider the following class definition. public class Rose { private int petals; private double cost; public Rose() { petals = 30; cost = 0.0; } public Rose(int p) { petals = p; cost = 0.0; } public int getPetals() { return petals; } public void setCost(int amount) { cost = amount; } } Which of the following are true? (i) The attribute cost can be set to a new value, by a user of this class. (ii) System.out.println (“The rose has: ” + Rose.getPetals()); is a valid statement. (iii) There are overloaded constructors in the class. i. ii   Only i and iii None are true

  8. All are true Question 8. Question : (TCO 2) Assume a class has a data member called ‘color’. Can another class have a data member called ‘color’?     Yes, as long as the data member is used in the same way. No, this is not possible because the compiler would not know which data member to use. Yes, but only if the classes are not in the same namespace. None of the above Question 9. Question : (TCO 5) Which error handling technique is the least appropriate when developing an application?     Check for potential problems and abort the application when a problem is encountered. Check for potential problems and throw an exception. Check for potential problems, catch the mistake and try to fix it. Ignore the problem; all applications crash at some point. Question 10. Question : (TCO 2) Which is an appropriate choice for a static (or otherwise called class) attribute in a Building class?     Number Of Buildings Number Of Apartments Number Of Floors None of the above CIS 247 DeVry Week 3 Quiz Latest 1. Question : (TCO 2) Which of the following statements is/are true?      Object names are listed in the middle section of a UML diagram. Attribute names are listed in the middle section of a UML diagram. Method names are listed in the middle section of a UML diagram. Class names are listed in the middle section of a UML diagram. None of the above Question 2. Question : (TCO 2) Java, C#, and C++ all allow for the use of comments. Which of the following statements are true regarding comments?       The compiler will ignore all comments if they are properly formatted. The IDE will ignore all comments if they are properly formatted. The output console will ignore all comments if they are properly formatted. All of the above None of the above

  9. Question 3. Question : (TCO 2) Attributes represent the _____ of an object because they store information about that object.     state behaviors size accessibility Question 4. Question : (TCO 2) If a programmer does not explicitly define a(n) _____, a default version will be provided by the compiler.      destructor method constructor attribute All of the above Question 5. Question : (TCO 2) One of the ways object-oriented languages protect object data is through _____.      integration of objects universal data access the public accessor encapsulation All of the above Question 6. Question : (TCO 2) Which of the following symbols indicate(s) level of access for both attributes and methods in a class.      + * ++ & All of the above Question 7. Question : (TCO 2) Object-oriented classes should be designed with the concept of a black box in mind. This means that users of the class should only need to know what _____ and _____ are associated with the class. The actual implementation details need not be known.     interface; implementation inputs; outputs objects; accessors relationships; interfaces

  10. Question 8. Question : (TCO 2) One of the benefits of _____ is that it allows the implementation of a class to change without affecting external entities using that class.     abstraction encapsulation instantiation construction Question 9. Question : (TCO 2) Which of the following is a proper implementation for a getter?     int getAge() { return age;} void getAge() {return age;} int getAge(int newAge) {this.age = newAge;} void getAge() {return age;} Question 10. Question : (TCO 2) Identify the attribute declaration(s) below that most likely contribute to the concept of information/data hiding.      private string name; private name; string private name; string name; None of the above CIS 247 DeVry Week 4 Quiz Latest 1. Question : (TCO 3) Which statement is true regarding the principles of an object-oriented language?     Persistence is not an optional object-oriented language requirement. All methods should be public when declare inside a class. Encapsulation means hiding data in a class from other classes. Class attributes should be global so all elements of the program can see them. Question 2. Question : (TCO 3) When would a programmer write more than one constructor?     You never have more than one constructor The constructor cannot be overloaded So objects can be treated the same way as variables of built in data types None of the above Question 3. Question : (TCO 3) Which of the following might be potential class(es) in an application?     Checking Account Customer Deposit A and B

  11. None of the above Question 4. Question : (TCO 3) Why do classes need to collaborate with each other?     Most classes do not exist in isolation. Classes need to interact with other classes to exchange data. None of the above Both A and B Question 5. Question : (TCO 3) Assume you have an Employee class with a non-static attribute named salary. If you create ten objects of this class, how many copies of the salary variable will you have?     2 10 An unlimited number None of the above Question 6. Question : (TCO 3) What does SOW stands for in the object-oriented design process?     Sequence of work Structure of work Statement of work None of the above Question 7. Question : (TCO 3) In the object-oriented design process, which of the following is true?      The cost of a design change in the implementation phase is very low. The cost of a requirement/design change in the design phase is very high. The cost of a design change after the deployment phase is astronomical . All of the above None of the above Question 8. Question : (TCO 3) To _____ an object is to create it.     instantiate encapsulate abstract overload Question 9. Question : (TCO 3) Every object of the same class _____.     gets a copy of every instance variable only gets a copy of every instance variable and method gets a copy of every method only None of the above

  12. Question 10. Question : (TCO 3) Classes do not have the ability to _____.     encapsulate data. enforce information hiding contain both data and functions know how other classes are implemented CIS 247 DeVry Week 5 Quiz Latest 1. Question : (TCO 3) Which of the following is/are the mechanism(s) for code reuse?     Inheritance Composition Inheritance and composition None of the above Question 2. Question : (TCO 4) Which of the following is true about inheritance?     Child classes are more generalized than their associated parent classes. Inheritance demonstrates the generalization/specialization relationship. Parent classes are more specialized than their associated child classes. Parent classes contains more functionality than child classes. Question 3. Question : (TCO 4) Select the parent class.     Barking Dog Yodeling Dog Golden Retriever Dog Question 4. Question : (TCO 4) Which of the following is not a good example of a hierarchy that could be modeled by inheritance?     Airplanes Geometric shapes Animals Prime numbers Question 5. Question : (TCO 4) Which of the following examples represent(s) the “is-a” relationship in the parent/child format?     dog/cat rectangle/circle checking account/saving account None of the above

  13. Question 6. Question : (TCO 3) What is/are the reason(s) to use inheritance?     Labor division Introducing modularity into program Reusing design All of the above Question 7. Question : (TCO 3) If class B is inherited from class A, which of the following statements is true?     Class A has access to the methods and fields of class B. Class A has access to the methods and fields of class B and class B’s subclasses. Class B does not have access to the methods and fields of class A. Class B has access to the methods and fields of class A. Question 8. Question : (TCO 4) Which accessibility modifier is most general?     Private Default Public Protected Question 9. Question : (TCO 4) Which of the following refers to a class that inherits from a parent class?     Child classes Derived classes Subclass classes All of the above Question 10. Question : (TCO 6) Which of the following are benefits of using inheritance?     Smaller chance of errors Ease of use for users of class Time saving All of the above CIS 247 DeVry Week 6 Quiz Latest 1. Question : (TCO 7) An instance of an abstract class can be created using _____.     the new operator encapsulation a public accessor None of the above

  14. Question 2. Question : (TCO 7) An abstract _____ is used only to form related subclasses using inheritance since it cannot be instantiated.     method class object attribute Question 3. Question : (TCO 7) Which of the following statements is false?  An abstract method is a method signature without a method body and can be found in an abstract class. If a subclass extends an abstract base class, the subclass must implement the abstract method(s) from the base class, or else call itself abstract also. Any method in an abstract class is considered an abstract method. Abstract methods are inherited.    Question 4. Question : (TCO 7) Which of the following classes is most likely an abstract class?     Vehicle Blue Spruce Hand Saw Goldfish Question 5. Question : (TCO 7) In terms of object-oriented programming, a(n) _____ is a mechanism that forces a programmer to adhere to specific rules when developing an application.      contract base class requirements analysis method signature None of the above Question 6. Question : (TCO 7) _____ and _____ can contain abstract methods.     Abstract classes; base classes Abstract classes; interfaces Interfaces; base classes None of the above Question 7. Question : (TCO 7) Multiple inheritance is defined as the ability to do what?     Identify multiple superclasses for a single class Create multiple subclasses from a single superclass Override multiple methods in a base class Overload multiple superclasses for a single class

  15. Question 8. Question : (TCO 7) Which of the following class definitions defines a legal abstract class?     class abstract Dog { void grow(); } public abstract class Dog { void eat (){} } abstract private class Dog { void eat (); } public class abstract Dog { void eat (){} } Question 9. Question : (TCO 7) Which of the following declares an abstract method in an abstract Java class?     public abstract calc(); public abstract void calc(); public void calc() {} public void abstract calc(); Question 10. Question : (TCO 7) Which of the following statements is true?    Interfaces contain a list of already implemented methods. Interfaces contain a list of pre-defined attributes with default values . All methods defined in an interface must be implemented by any class that chooses to implement the interface. At least one of the methods defined in an interface must be implemented by any class that chooses to implement the interface.  CIS 247 DeVry Week 1 iLab Latest iLab 1 of 7: Creating a User Interface iLAB OVERVIEW Scenario and Summary This program creates the basic user interface code that can be used in the following weeks’ iLab assignments. The assignment will help you get started using the programming environment and some practice with coding. You will also be able to reuse much, if not all, of the code in later assignments. In this program, you will create the following methods: 1. Display Application Information, which will provide the program user some basic information about the program. 2. Display Divider, which will provide a meaningful output separator between different sections of the program output.

  16. 3. Get Input, which is a generalized function that will prompt the user for a specific type of information, then return the string representation of the user input. 4. Terminate Application, which provides a program termination message and then terminates the application. Using these methods, you will construct a program that prompts the user for the following: 1. his or her name, which will be a string data type; 2. his or her age, which will be an integer data type; 3. the gas mileage for the user’s car, which will be a double data type; and 4. a display of the collected information. Also, note that the program should contain a well-documented program header. Deliverables Step Step 4 Step 5 Deliverable Screen shot of running program results Zip file with entire Lab files Preparation: If you are using the Citrix remote lab, follow the login instructions located in the iLab tab in Course Home. Launch your integrated development environment (IDE) to begin. iLAB STEPS STEP 1: Review the Design .equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa- d30418a01912/1/CIS247B_W1_iLab.html#top”>Back to Top Download the program description and pseudocode. Make sure you fully understand the program design and ask any questions that you may have BEFORE you start programming. Click.equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa-d30418a01912/1/documents– cis247B_wk1_design.pdf”>Week 1 Lab Designto download program design. STEP 2: Construct the Program .equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa- d30418a01912/1/CIS247B_W1_iLab.html#top”>Back to Top 1. Create a new project titled “CIS247B_WK1_Lab_LASTNAME”.

  17. 2. Using the Week 1 Lab Design document to construct the methods. 3. Once the methods are constructed, use the Week 1 Lab Design document to create the main program. STEP 3: Compile and Test .equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa- d30418a01912/1/CIS247B_W1_iLab.html#top”>Back to Top  When done, ensure that there are no compilation errors. If there are errors, open up the Error list and fix all listed errors. Execute your code and check your output to ensure that you have the desired output. If you need to fix anything, close your execution window, modify your code as necessary, and rebuild.  STEP 4: Screen Prints .equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa- d30418a01912/1/CIS247B_W1_iLab.html#top”>Back to Top   Capture a screen shot of your application’s output and paste it into a Word document. The output of your code should resemble the following: STEP 5: Submit Deliverables .equella.ecollege.com/file/201a06d7-5ccb-49e8-b4fa- d30418a01912/1/CIS247B_W1_iLab.html#top”>Back to Top   Put all of the project files into a zip file. Put the zip file and screen shots (Word document) in the Dropbox. CIS 247 DeVry Week 2 iLab Latest iLab 2 of 7: Employee Class Remember This! .devry.edu/vpn/index.html”>Connect to the iLab here. Note! Submit your assignment to the Dropbox located on the silver tab at the top of this page. (See the Syllabus section “Due Dates for Assignments & Exams” for due dates.) iLAB OVERVIEW Scenario and Summary We begin our investigation of object-oriented programming by creating an object-oriented program with a class called Employee. You will create two objects based on the Employee class, along with a class that

  18. contains the main method. The attributes, constructors, and methods for this class must satisfy the requirements in Steps 1 through 3. After you create the objects, you will prompt the user for information and then display it. We will want to ensure that this first class is well-constructed and tested since we will extend this class in Labs 3 through 6. Deliverables Due this week: Capture the Console output window and paste it into a Word document. Zip the project folder files. Put the zip file and screen shots (Word document that contains programming code and screen shots of program output) in the Dropbox. iLAB STEPS STEP 1: Understand the UML Class Diagram .equella.ecollege.com/file/6eeabc50-43d2-410a-9a6f-a74f918a92f7/1/CIS247B_W2_iLab.html#top”>Back to Top Use the following UML diagram to build the class. The first section specifies the attributes. The second section specifies the behaviors, and the first character specifies the access modifier value, where:   “-” means that the class member is private, and “+” means that the class member is public. STEP 2: Code the Employee Class .equella.ecollege.com/file/6eeabc50-43d2-410a-9a6f-a74f918a92f7/1/CIS247B_W2_iLab.html#top”>Back to Top 1. Create a new project called “CIS247B_WK2_Lab_LASTNAME”. 2. Using the provided Class Diagram from Step 1, code the Employee class in the new project (i.e., “Realize the UML Class diagrams”). 3. The default constructor should set the attributes as follows: o firstName = “not given”

  19. o lastName = “not given” o gender = “U” (for unknown) o dependents = 0 o annualSalary = 20,000 4. The multi-arg constructor should initialize all of the attributes using values passed in using its parameter list. 5. As shown in the Class diagram, each attribute should have a “getter” to retrieve the stored attribute value, and a “setter” that modifies the value. 6. The calculatePay( ) method of the Employee class should return the value of annual salary divided by 52 (return annualSalary / 52;). 7. The displayEmployee() method should display all the attributes of the Employee object in a well- formatted string with logical labels applied to each attribute. Don’t forget to call calculatePay from within the displayEmployee method in order to display the Employee’s weekly pay as well! 8. Inside displayEmployee, create a NumberFormat object for currency with the following: 9. Display the pay with the following: STEP 3: Code the Main Program .equella.ecollege.com/file/6eeabc50-43d2-410a-9a6f-a74f918a92f7/1/CIS247B_W2_iLab.html#top”>Back to Top In the Main class, create code statements that perform the following operations. Be sure you follow proper commenting and programming styles (header, indentation, line spacing, etc.). 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 to convert gender, dependents, and annual salary from strings to the appropriate data type.) 3. Using your code from last week, display a divider that contains the string “Employee Information” 4. Display the Employee information.

  20. 5. Create a second Employee object using the multi-argument constructor, setting each of the attributes with appropriate valid values. 6. Using your code from last week, display a divider that contains the string “Employee Information”. 7. Display the Employee information for the second Employee object. STEP 4: Compile and Test .equella.ecollege.com/file/6eeabc50-43d2-410a-9a6f-a74f918a92f7/1/CIS247B_W2_iLab.html#top”>Back to Top 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. Your output should resemble the following: STEP 5: Submit Deliverables .equella.ecollege.com/file/6eeabc50-43d2-410a-9a6f-a74f918a92f7/1/CIS247B_W2_iLab.html#top”>Back to Top   Capture the Console output window and paste into a Word document. Put the zip file and screen shots (Word document) in the Dropbox. CIS 247 DeVry Week 3 iLab Latest iLab 3 of 7: Overloaded Methods and Static Methods / Variables 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 static variable called numEmployees that holds an int and initialize it to zero. This will allow us to count all the Employee objects created in the main class. 2. Increment numEmployees in all of the constructors

  21. 3. Add overloaded versions of setDependents and setAnnualSalary that accept strings. This way, we will have two “set” methods for both dependents and annual salary; one that accepts a string, and one that accepts its default data type. Deliverables Due this week:    Capture the Console output window and paste it into a Word document. Zip the project folder files. Put the zip file and screen shots (Word document that contains programming code and screen shots of program output) in the Dropbox. iLAB STEPS STEP 1: Understand the UML Diagram .equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/CIS247B_W3_iLab.html#top”>Back to Top The following attribute has been added: – static numEmployees: int = 0 The following behaviors have been added: + static getNumEmployees( ) : int + setDependents(in dep : String) : void + setAnnualSalary(in sal : String) : void STEP 2: Create the Project .equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/CIS247B_W3_iLab.html#top”>Back to Top 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 by following these steps: 1. Open the same workspace you created for the Week 2 project. 2. Create a new project named “CIS247B_WK3_Lab_LASTNAME”. An empty project will then be created. 3. Copy your main class and employee class files from Week 2 and paste them into the Week 3 project.

  22. 4. Before you move on to the next step, build and execute the Week 3 project. For each week’s assignments, you will follow these steps create a new project that reuses the program from the previous week. STEP 3: Modify the Employee .equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/CIS247B_W3_iLab.html#top”>Back to Top Using the UML Diagrams from Step 1, code the changes to the Employee class. a. Create a static numEmployees variable and initialize it to zero. b. Increment numEmployees by 1 in each of the constructors. c. Create an overloaded setDependents method and, this time, make the parameter a string. d. Create an overloaded setAnnualSalary method and, this time, make the parameter a string. Rememberthat you will have to convert the string in the above two “set” methods to the data type of the attribute. e. Make the getNumEmployees a static method. (This way, you can call it with the class name instead of an object name.) Be sure you follow proper commenting and programming styles (indentation, line spacing, etc.). STEP 4: Modify the Main Method .equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/CIS247B_W3_iLab.html#top”>Back to Top In the Main class, create code statements that perform the following operations. Be sure you follow proper commenting and programming styles (header, indentation, line spacing, etc.). Note that several of the steps below were accomplished in last week’s assignment. New steps are in bold. 1. Create an Employee object using the default constructor. 2. Prompt for and then set the first name, last name, and gender. Consider using your getInput method from Week 1 to obtain data from the user for this step as well as Step 3. 3. Prompt for and then set dependents and annual salary using the new overloaded setters.

  23. 4. Using your code from Week 1, display a divider that contains the string “Employee Information”. 5. Display the Employee Information. 6. Display the number of employees created using getNumEmployees. Remember to access getNumEmployees using the class name, not the Employee object. 7. Create a second Employee object using the multi-arg constructor, setting each of the attributes with the following values: “Mary”, “Noia”, ‘F’, 5, 24000.0 8. Using your code from Week 1, display a divider that contains the string “Employee Information”. 9. Display the employee information for the second Employee object. 10. Display the number of employees created using getNumEmployees. Remember to access getNumEmployees using the class name, not the Employee object. STEP 5: Compile and Test .equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/CIS247B_W3_iLab.html#top”>Back to Top When done, compile and run your code. 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. Your output should resemble the following: STEP 6: Submit Deliverables .equella.ecollege.com/file/74ae7c2a-07fb-40ac-84b9-a1f901a7ec46/1/CIS247B_W3_iLab.html#top”>Back to Top   Capture the output window and paste it into a Word document. Put the zip file and screen shots (Word document) in the Dropbox. CIS 247 DeVry Week 4 iLab Latest iLab 4 of 7: Composition and Class Interfaces Scenario and Summary

  24. The objective of the lab is to modify the Employee class to demonstrate composition and a class interface. An employee typically has benefits, so we will make the following changes: 1. Create a Benefits class. 2. Integrate the Benefit class into the Employee class. 3. Create an iEmployee abstract class to guarantee that calculatePay is implemented in the Employee class. A tutorial on interfaces can be downloaded.equella.ecollege.com/file/99187c60-80a4-48a0-b203- 0544f90accd2/1/documents–Interfaces_Java.docx”>here. Deliverables Due this week:    Capture the Console output window and paste it into a Word document. Zip the project folder files. Put the zip file and screen shots (Word document that contains programming code and screen shots of program output) in the Dropbox. iLAB STEPS STEP 1: Understand the UML Diagram .equella.ecollege.com/file/99187c60-80a4-48a0-b203- 0544f90accd2/1/CIS247B_W4_iLab.html#top”>Back to Top The only change to the Employee class is that there is a new attribute: +benefit : Benefit Notice that there is a “+” for this attribute, meaning that it is public. Make sure to examine the multi-arg constructor’s signature! Also, the dotted directed line between Employee and iEmployee specifies that the Employee class must implement the iEmployee abstract class, and thus provide an implementation for the calculatePay method. STEP 2: Create the Project .equella.ecollege.com/file/99187c60-80a4-48a0-b203- 0544f90accd2/1/CIS247B_W4_iLab.html#top”>Back to Top

  25. You will want to use the Week 3 project as the starting point for the lab. To do this, you will want to create a new project by following these steps: 1. Open the same workspace you created for the Week 3 project. 2. Create a new project and name it “CIS247B_WK4_Lab_LASTNAME”. 3. Copy all the source files from the Week 3 project into the Week 4 project. 4. Before you move on to the next step, build and execute the Week 4 project. STEP 3: Modify the Employee Class .equella.ecollege.com/file/99187c60-80a4-48a0-b203- 0544f90accd2/1/CIS247B_W4_iLab.html#top”>Back to Top 1. Using the UML Diagrams from Step 1, create the Benefit class. To get an idea of how to format displayBenefits, take a look at the output in Step 5. 2. Add a Benefit attribute to the Employee class. 3. Initialize the new Benefit attribute in both Employee constructors. Again, take note of the multi-arg constructors parameter list! 4. Create the iEmployee interface. 5. Modify the Employee class to implement the new interface so that Employee will have to implement the calculatePay method. 6. Modify the Employee class to call displayBenefit when displaying Employee information. STEP 4: Modify the Main Method .equella.ecollege.com/file/99187c60-80a4-48a0-b203- 0544f90accd2/1/CIS247B_W4_iLab.html#top”>Back to Top Notice that the Employee class now has a public benefit object inside it. This means that you can access the set methods of the Benefit object with the following code: .benefit. As an example, to set the lifeInsurance attribute inside an Employee object called emp, we could execute the following code:

  26. emp.benefit.setLifeInsurance(lifeInsurance); The steps required to modify the Main class are below. 1. Create an Employee object using the default constructor. 2. Prompt for and then set the first name, last name, and gender. Consider using your getInput method from Week 1 to obtain data from the user for this step as well as Step 3. 3. Prompt for and then set the dependents and annual salary using the overloaded setters that accept Strings. 4. Prompt for and set healthInsurance, lifeInsurance, and vacation. 5. Using your code from Week 1, display a divider that contains the string “Employee Information”. 6. Display the Employee Information. 7. Display the number of employees created using getNumEmployees(). Remember to access getNumEmployees using the class name, not the Employee object. 8. Create a Benefit object called benefit1 using the multi-arg constructor. Use any information you want for health insurance, life insurance, and vacation. 9. Create another Employee object and use the constructor to fill it with the following: “Mary”, “Noia”, ‘F’, 5, 24000.0, benefit1 10. Using your code from Week 1, display a divider that contains the string “Employee Information”. 11. Display the employee information. 12. Display the number of employees created using getNumEmployees(). Remember to access getNumEmployees using the class name, not the Employee object. STEP 5: Compile and Test .equella.ecollege.com/file/99187c60-80a4-48a0-b203- 0544f90accd2/1/CIS247B_W4_iLab.html#top”>Back to Top When done, compile and execute your code. 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.

  27. Your output should resemble the following: STEP 6: Submit Deliverables .equella.ecollege.com/file/99187c60-80a4-48a0-b203- 0544f90accd2/1/CIS247B_W4_iLab.html#top”>Back to Top Capture the Console output window and paste it into a Word document. Put the zip file and screen shots (Word document) in the Dropbox. 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 STEP 1: Understand the UML Diagram

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

  29. 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 Using the UML Diagrams from Step 1, 1. Create the Hourly class, ensuring to specify that the Hourly class inherits from the Employee class.

  30. 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’stoString 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 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.

  31. 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 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 STEP 1: Understand the UML Diagram . equella.ecollege.com/file/2164b3b4-af98-4f45-b574-7ccdf6be9873/1/CIS247B_W6_iLab.html#top”>Back to Top

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

  33. 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 Empl

More Related