Disclaimer: This is an example of a student written essay.
Click here for sample essays written by our professional writers.

Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of UKEssays.com.

Defining Abstraction Encapsulation Modularity And Hierarchy English Language Essay

Paper Type: Free Essay Subject: English Language
Wordcount: 2766 words Published: 1st Jan 2015

Reference this

Abstraction:-A crucial element of object-oriented programming is abstraction. Basically abstraction means without knowing the background detail. Provide an interface for create family of associated or needy objects without specify their concrete module. Abstraction is nothing but data hiding. In java we will supply the object to user then they will use the objects but they don’t know what is phenomenon the behind. This is called abstraction. Abstraction uses in order to do some works easily.

E.g.:- This abstraction is allowing people to use a scooter to drive to the grocery store without being overwhelmed by the complexity of the parts that form the scooter. They can ignore the details of how engine, transmission and braking systems work.

Encapsulation:-Encapsulation is as a shielding wrapper. Access to the code and data inside the wrapper is tightly embarrassed during a well-defined interface. Encapsulation means Data Hiding. Another assistance of encapsulation is that it reduces system complication and thus increases toughness by restrictive the interdependencies between software mechanism One of the chief mechanism for hiding information is encapsulation combine elements to create a well-built entity. The programmers can then focal point on the new article without upsetting about the hidden details.

Get Help With Your Essay

If you need assistance with writing your essay, our professional essay writing service is here to help!

Essay Writing Service

Modularity: – Modularity is a wide-ranging systems concept, characteristically definite as a continuum recitation the degree to which a system’s mechanism may be unconnected and recombined. It refers to both the stiffness of coupling between components, and the degree to which the “rules” of the system architecture enable (or prohibit) the mixing and matching of components. Its use, however, can vary somewhat by context: Modularity is scheming a system that is divided into a set of purposeful units (named modules) that can be unruffled into a larger application. Modules are independent of one another but can converse with each other in a insecurely together fashion.

Hierarchy: – Hierarchy (Greek: hierarchic (ἱεραρχία), from hierarchs, “leader of sacred rites”) is a grounding of items (objects, names, values, categories, etc.) in which the items are correspond to as being “above,” “below,” or “at the equivalent plane as” one more and with only one “beneficiary civilian” above and below each level. These classifications are made with observe to rank, corollary, superiority, power status or authority a hierarchy of power is called a supremacy configuration. Abstractly, a pecking order is fundamentally a regimented set or an acyclic graph.

Hierarchy can link entity either unswervingly or circuitously, and either vertically or horizontally. The only direct links in a pecking order, in so far as they are hierarchical, are to one’s immediate superior or to one of one’s subsidiary, though a system that is largely hierarchical can also integrate other administrative patterns. All parts of the pecking order which are not linked perpendicularly to one another nevertheless can be “horizontally” linked through a path by peripatetic up the pecking order to find a prevalent direct or indirect improved and then downwards again.

Q2) Sketch the object-oriented design or the Card game Black-Jack. What are the key objects? What are the properties and behaviours of these objects? How does the object interact?

Ans2) Key Objects:-


Playing Card

Card Deck

Game Deck

BACKGROUND: – Blue is an incorporated expansion environment for Java, residential by Michael Killing and John Rosenberg [4, 6]. It has befall a popular preference for preliminary Brainwashing courses because of the ease with which unqualified cut down can learn how to use its features [2, 3, and 7]. Though admittedly the features of Blue are limited compared to full-fledged IDE alternatives such as builder [8] and Eclipse [9], its functionality is more than adequate for a preliminary-level course. Even “lightweight” IDEs such as grasp [10] present a steeper learning curve for students, both in terms of setting up and constitution of the software and the development of compile and management their first Java program.


The Blue environment includes its graphical depiction of the course and objects within a project, and the straightforwardness with which students can interact with them through a succession of pop-up menus.

In particular, using the scrutinize option of the pop-up menu connected with objects; students can directly see the values of the fields of an object.


The Blue package is distributed with a library of sample code, including a project

Called “picture” [5]. In order to initiate the students to the syntax of a Java program, as well as to the description of the Blue IDE, I educate them, as a guided lab exercise, to modify the existing code of class Picture. Students must write supplementary method calls and change stricture values in such a way that the standard of the mechanism of the image change and a picture of a fir tree appear next to the house. Examples are shown in Figures 1 and 2.As a preliminary “warm-up” programming project, based on what they educated in the lab, students are requisite to write a Java class that generate a picture of their own design. They are allowed to impersonate the code of class Picture, but their resulting image must be considerably different. After the assignment is submitted, I show the most complicated of the images shaped onscreen. The creative component introduces an element of light-hearted competition among the students, which improve their attitude toward the project and increases their level of engagement. They invest extra time and endeavour trying to make their pictures look pragmatic Some students introduce simple animatronics elements, and even figure out how Figure 1: Classes in Blue project “picture”

Figure 2: Results of first lab JCSC 22, 4 (April 2007) 52

Figure 3: A student’s implementation of “Assignment 0” to modify the provided sample code for drawing simple shapes in order to best accommodate their

Graphical design requirements. An example of a student’s “drawing” is shown in

Figure 3.

1) Playing Card

In the first assignment of the four-assignment succession mention above, students are required to put into practice a class Playing Card that simulate an actual playing card. The purpose of this obligation is to initiate the concept of a Java class and its components: fields, constructors, and methods. Class Playing Card include fields

Representing the suit and rank of a card object. The image contain a picture representing the suit icon (“hearts”, “spades”, etc.) which is collected of the same three simple shapes described above. As a result of this assignment, student learns the object-oriented concept of encapsulation, information hiding, message passing, and even overloading. Once again, the graphical depiction of a familiar object makes the project more appealing. An instance of a student’s reproduction is shown in Figure 4.

2) Card Deck

In order to introduce the functionality of Java arrays, the next obligation require

That student’s execute class Card Deck, which represent a standard deck of 52 cards. Class Card Deck within uses the Java array data structure to execute the anthology of cards. Students learn how to say publicly an array, how to create an array object, and how to colonize it with rudiments which are, in turn, objects of class Playing Card. Students learn how to use a loop structure in order to create the rudiments of the array, and how to use the Java array (i.e., [ ]) notation to access and/or modify elements of the array. By involving the concept of an array as a collection of objects to a familiar real-world “array” of cards, students understand the notion more readily. In addition to the constructor of Card Deck, students are required to write methods That access and return Playing Card objects stored at index 0 and at a random index in the array, and a method that “shuffles” the cards in the array by swapping pairs of elements at randomly selected indices.

3) Game Deck

To introduce the concept of inheritance and Method overriding. Class Game Deck is implementing as a subclass of the preceding class Card Deck. The difference between Card Deck and Game Deck is that the “number of cards” in Game Deck is decremented by one every time we access a card in the array. This simulates the dealing of cards in a game. In order to put into practice this more dedicated version of a deck of cards, students must include in Game Deck a new field that represents the current number of cards in the deck, as well as a new scheme that “remove” a card from the given position in the array by irregular the elements of the array to the left. In addition to that, methods of class Card Deck that were used to access the first element and a accidental element of the array of cards must be now override to include a call to the new method that remove a card from the array. Blue allow students to see in the pop-up menu associated with an object of Game Deck the methods inherited from Card Deck flanking those unambiguously written as part of class Game Deck. This helps them to better comprehend the mechanism of inheritance and code reuse.

Q: 3 Sketch the object-oriented design of a system to control a Soda dispensing machine. What are the key objects? What are the properties and behaviours of these objects? How does the object interact?

Ans 3) Please wait

Image not available

Please wait

Image not available


Please wait

Image not available

Image not available

Dixie Narco…what the vendor use…. Up for Dutch auction is a Dixie Narco DNCB440-8 select multi-price effervesce front drink appliance with complete coin system counting dollar bill acceptor. You can change the price in .05 increments on any or all selections…These are $800-1000. Machines..!! We guarantee them to cool and they are location ready. You won’t find better machines anywhere for the money..!! 

These are great can machinery and they will do 16 oz. bottles reasonably well in the slighter racks too..!! These have the “7-UP” graphics….These are used machines. Therefore, there may be minor scratches and/or nicks. However, they look real sharp… Overall magnitude is 79″ tall, 37″ wide and 31″ deep weigh approx. 800 lbs.

Also, add $15.00 if you need us to supply a lock or you can pick one up at just about any locksmith shop. Local liberation is available in the greater Dallas/Ft. Worth area for $125.00 accompanying charge contrivance must be paid within 5 days of auction close. We are one of the nation’s prevalent eBay sellers of vending machines, so check our response and bid with buoyancy..!!!

Part B

Q: 4) In an object oriented inheritance hierarchy; the objects at each level are more specialized than the objects at the higher levels. Give three real world examples of a hierarchy with this property.

Ans4) Object Oriented Inheritance Hierarchy

Hierarchical designing of a program we can solve any complex task in Object Oriented Programming. Another Interesting application of inheritance is to use it as a support to the hierarchical design of a program. In C++, A problem can be easily solved by converting the problem into class hierarchies. In this class hierarchy the top most class also called as root includes all the features that are common to its subclasses and these subclasses can be constructed by inheriting features of its base class, in turn these subclasses can act as a base class for the lower level classes and so on.

Three real world examples:

Washing Machine




Washing Machine: – In old generation mainly washing machines is very simple low of cost. These machines are used only for washing clothes but in this generation those machines are used for washing clothes and dry clothes also and the cost is high so we can say that in this generation we have so many techniques for washing clothes and dry also.

Car: – In old generation mainly cars are used with the help of key and control the starring then we can use the car but in this generation the cars are very intelligent or expert if you can give the command and car is move in your choice. All home things are available in car.

Robots: – The Sony Entertainment Robot Aibo (ERS-110), uses a amalgamation of robotic and media technology with machine cleverness to generates dealings with its operator. A question paper of the Aibo hardware and software reveal how an object becomes a life-like companion. The Sony product name Aibo stands for Artificial Intelligence robot. It can respond to voice commands, detect obstacle, plays tricks, and more. Aibo’s individuality develops by interact with people. Each AIBO grows in a dissimilar way, based on its individual experiences. AIBO becomes modified based on criticism and the software organism used.


Q: 5 How do methods System.out.print () and System.out.println () differ? Define a java constant equal to 2.9979 X 108 that approximates the speed of light in meters per second.

Ans5: Difference between System.out.print () and System.out.println ()

1) System.out.print ():- This print function is used to print the given statement. This is used to print the output in a single line.

Eg:- class loop


public static void main (String args[ ])


int a;





Output 01234

2) System.out.println ():-This println function is used to print the output in started or a new line.

class loop


public static void main (String args [ ])


int a;

For (a=0; a<=4; a++)

System.out.println (a);









Declaration of the constant value with symbolic constant is

Final double SPEED_OF_LIGHT=2.9979e8

Q6) Write a code segment that defines a Scanner variable stdin that is associated with System. In. The code segment should than define to int variables a and b, such that they are initialized with the next two input values from the standard input stream.

Ans6) Solution:

import java.util.Scanner;

class Number


public static void main (String args[ ])


Scanner stdin=new Scanner (System. in);

System.out.println (“Enter the two numbers”);

int a=stdin.nextInt ();

int b=stdin.nextInt ();

System.out.println (“The first no is” +a);

System.out.println (“The second no is” +b);




Enter the two numbers



The first no is 3

The second no is 5

Q7) separately identify the keywords, variables, classes, methods and parameters in the following definition:

Import java.util.*;

public class test


public static void main (String [ ] args)


Scanner stdin = new Scanner (System. in);

System.out.print (“Number :”);

double n = stdin.nextDouble ();

System.out.println (n + “* “+ n + “= “+ n * n);



Ans 7)


import, public, static, void, double, new




Test, Scanner, System


main, print, println


String [ ] args, System. In




stdin, out


Cite This Work

To export a reference to this article please select a referencing stye below:

Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.
Reference Copied to Clipboard.

Related Services

View all

DMCA / Removal Request

If you are the original writer of this essay and no longer wish to have your work published on UKEssays.com then please: