Preview

Gkjg

Good Essays
Open Document
Open Document
612 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Gkjg
SWEN.5132 -- Software Design Patterns

Assignment 2

FirstName: Sampath kumar reddy

LastName: Jonnalagadda

Grade:

Homework Questions:

1. The implementation of Prototype Pattern involves a creation of an object by another object. This capability is purely related with each programming language. We have given 3 examples by using 3 different languages.

a. In C#, which system function we have used to fulfill this purpose?

ANS:

To fulfill this purpose in C# we use the ‘object.MemberWiseClone()’ method.

b. Use online resource http://msdn.microsoft.com/en-us/library/default.aspx for following question: Please explain this function, including an example to illustrate the usage.

ANS:

With this function it creates a Shallow copy of the current object. MemberwiseClone() cannot be override or overridden, and is only one accessible through this class or a derived class. A shallow copy creates a new instance of the same type as the original object, and then creates copy of the non-static fields of the original object.

c. What is the name of the function in Java that performs the same purpose? Give an example.

ANS:

In most cases we use Clone () function in java to implement prototypes related programs . it can be illustrated an example .

import java.util.List; import java.util.LinkedList; import java.util.Iterator; public class CloningExample implements Cloneable { private LinkedList names = new LinkedList(); public CloningExample() { names.add("A"); names.add("B"); names.add("C"); } public String toString() { StringBuffer sb = new StringBuffer(); Iterator i = names.iterator(); while (i.hasNext()) { sb.append("\n\t" + i.next()); } return sb.toString(); } public Object clone() { try { return

You May Also Find These Documents Helpful

  • Satisfactory Essays

    b. Include the function written in Exercise 2a in a working program. Make sure your function…

    • 720 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    The plant method design pattern generates a group of connected items instantiated by subclasses (University of Phoenix, 2005). This design pattern generates items without indicating the category of item that's to be generated. The plant method pattern describes a different way of producing items by using subclasses to override the derived kind of item that's to be generated.…

    • 579 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Step 2: Think of good variable names for the following pieces of data that will need to be stored with in this program.…

    • 777 Words
    • 4 Pages
    Satisfactory Essays
  • Good Essays

    Nt1330 Unit 1 Assignment 1

    • 4614 Words
    • 19 Pages

    A ______ is rectangular area that can contain a document, program, or message option1 A __________ contains icon buttons that access frequently used commands A __________ provides access to features of the program A built-in tool that performs calculations automatically is a(an) A collection of related data that has been entered into a computer is called a A collection of separate software applications that are sold as a group, like Microsoft Office, is called a(n) A database sort directs the software to find and display one or more records option2 option1 option3 option3 option4 option2…

    • 4614 Words
    • 19 Pages
    Good Essays
  • Powerful Essays

    B. Write Code inside the main method and test it by compiling (F9) and running (Shift + F6) your code.…

    • 2338 Words
    • 10 Pages
    Powerful Essays
  • Powerful Essays

    Mat 540 Week 4 Paper

    • 1775 Words
    • 8 Pages

    Although the details can be quite complex, these details are the basic principles of object-oriented programming.…

    • 1775 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    B. Program Design – Following the directions in the assignment, clearly write up your problem design in this section and comment your pseudocode.…

    • 761 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    6 8c Chapter Excercises

    • 515 Words
    • 2 Pages

    In object-oriented analysis each object represents real people, places, events, and transactions (nouns). Unlike structured analysis, which treats data and processes separately, objects include data and processes that can affect the data. A major advantage of O-O designs is that systems analysts can save time and avoid errors by using modular objects, and programmers can translate the designs into code, working with reusable program modules that have been tested and verified…

    • 515 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    A. Program Design – Following the directions in the assignment, clearly write up your problem design in this section and comment your pseudocode.…

    • 467 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    c) Its application to the given scenario: The website provides research finding on how a…

    • 1578 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    jckgg

    • 1546 Words
    • 4 Pages

    What in Richard Nixon’s Background shaped him into the angry, ambitious man he became? How did his character traits affect his political career? What did he tell a supporter of Jerry Voorhis the most important thing was? What does this tell you about Nixon’s character?…

    • 1546 Words
    • 4 Pages
    Good Essays
  • Good Essays

    In the movie Multiplicity, Doug Kinney is a construction worker struggling to make a living. When a scientist offers to clone him, Doug accepts the offer and creates an improved version of himself. At first, Doug’s clones seem to lift burdens off his shoulders. But as the movie progresses, his clones start to take over his home, job, and even his wife. With the advanced technology in our modern world, similar situations may become a reality.…

    • 1138 Words
    • 5 Pages
    Good Essays
  • Good Essays

    Object Oriented Processes

    • 400 Words
    • 2 Pages

    Think about this task in an object-oriented way, and identify the objects involved in the task.…

    • 400 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Hjgk

    • 292 Words
    • 2 Pages

    • Inter-dependent decision-making: Inter-dependence means that firms must take into account the likely reactions of their rivals to any change in price, output or forms of non-price competition.…

    • 292 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Creative Writing

    • 813 Words
    • 4 Pages

    A. Program Design – Following the directions in the assignment, clearly write up your problem design in this section and comment your pseudocode.…

    • 813 Words
    • 4 Pages
    Satisfactory Essays

Related Topics