Question

You are the lead trainer for the software development team at a large telecommunications company. You...

You are the lead trainer for the software development team at a large telecommunications company. You have been tasked with preparing a training document that explains the principles of polymorphism, inheritance, and encapsulation. Research these principles and provide examples for each principle, showing how they would be used in software development. Be sure to answer the question of how each principle would be employed in the software development process.

Java programmers use class hierarchies for the purposes of inheritance. For example, given a Tree class, you could define Conifer and Deciduous subclasses that inherit from the parent Tree class, as follows:

In your training document explanations regarding inheritance, depict inheritance by using a computer memory hierarchy in a class hierarchy diagram.

Deliverable

Research computer memory hierarchy and the topic to use in your inheritance explanations at this link. Develop a class hierarchy diagram for the memory hierarchy found at the URL. Include in your class hierarchy diagram at least three subclass levels. Each class and subclass must include at least one variable and one method.

Please answer to the questions in bold and don't copy from other posts.I need answers to the question only in bold.

Homework Answers

Answer #1

As per your question, First I will tell you, what is the basic concept behind polymorphism, inheritance, and encapsulation. Next, I will put the best and easy to understand example for polymorphism, inheritance, and encapsulation. Further, I will write the java programs on memory hierarchy as per your question. So, please bear with me:-

Polymorphism is nothing but creating "many forms" of a single logical method and it will use when we have many classes that are having the relationship between among by inheritance.

Basically, Polymorphism can be achieved by two approaches.

1. Overloading of methods: If all the forms of methods are defined in a single class

2. Overriding of methods: If the forms of methods are defined in more than one class and connected by inheritance.

Example:-

Inheritance is a powerful technique as well as a well-defined process where one class acquires the selected properties (methods and fields) of another class based on the relationship among them. By using the inheritance technique, we can able to manage the complex and very complex information in a hierarchical order.

A class that inherits the properties (methods and fields) of other class is known as subclass (derived class, child class) and the class whose properties (methods and fields) are inherited is known as superclass (base class, parent class).

Example:-

Encapsulation is a technique of binding or wrapping the data (variables) and its behaviors (methods) together as a single unit packet called class. Encapsulation also provides an abstraction of internal data (variables) from the outside world and the data (variables) only be accessed through its defined behaviors (method) of the current class.

Creating a class with variables and methods is nothing but encapsulation. For example:-

=> Now coming to your computer memory hierarchy example:-

public class Computer 
{ 
  private Memory mem; //A Computer has a unit Memory

  ...
}

class Memory // many types of memory exits in computer based on its use
{
  private int size;
  private int speed;
  private String kind;
  ...
}

class RAM extends Memory
{
  ...
}

class HDD extends Memory
{
  ...
}

class L1_Cache extends Memory
{
  ...
}

I hope, now you have a brief knowledge about polymorphism, inheritance, and encapsulation.

Please don't forget to like it...

Thank You...

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions