It2EDU

Sunday, March 19, 2017









A program is a solution of a specific program which is
unique for similar type problems. So a program is more helpful to find out the
solution of a problem. A program follow some syntax rules based on which
programming language is choose by the programmer.


Before going to solve a problem, a program has Algorithm and
Flow chart.


These two are helpful to find out the flow of program, input
information and approach of problem solving.





Use of a Flowchart:





A flowchart is used geometrical figure which represents the
flow of instructions of a program. We all know a program is set of
instructions.  How the instructions could
solve the problem what the data has to be taken by the user or programmer at
run time of a program. Also it shows how many variables are used to solve the
problem and what the operation is going to perform in the program everything
has presented in a clear way by using geometrical figures.


















The above diagram shows how the program is executed and what
variables are taken as input.


Also we need algorithm for the above program.


An algorithm is used to code the program in any programming
language.




  • Start

  • Accept variable of SUM, x and y.

  • Accept input for X and Y.

  • Perform operation SUM = X+Y

  • Print SUM

  • Stop.






After the algorithm is prepared start writing the code in
any programming language based on programmer interest it may be java, c, c++….
.net,python or any.


Every programming language has its own set of syntax and
rules, based on that rules programmer has to write the code. But here we need
to observe one thing that is irrespective of the programming language first
built the algorithm if the algorithm is good no doubt about you are the good
programmer.





You will find part-1 here.









Saturday, March 11, 2017









A MIME stands for Multipurpose Internet Mail Extension. In
the context of internet or web applications the way of identifying files
according to their nature and format. While developing the web applications
specify content-type in the header part of HTTP – response. 


A MIME type is a
mechanism that can be informed to the client the variety of document
transmitted. Extensions of the files has plays a small role in the web. 





General form of MIME is type/subtype. it is the syntax for mime type





Below are few  MIME
types :


  • Text/html - for Html files

  • multipart/zip - for zip files

  • Application/msword - for word documents

  • image/jpeg - for JPEG image files



RFC defines messages have two parts one is header and a
body. These header and body represents in ASCII text format. The body of the message
is a simple text originally. RFC has decided how to send information in any
format means file or image or video. SO it was introduced MIME for sending
image type data or any other formatted data.


The message header is a series of <CRLF> terminated lines.
CRLF stands for carriage return line feed which are a pair of ASCII control
characters often used straight forward encoding of binary data into ASCII
character set.  This encoding is called
base64. In this approach every three bytes of data into 4 ascii
characters.  This is done by grouping the
binary data into 24-bit units and breaking each such unit into four 6-bits
pieces. Each 6-bit piece maps onto one of 64 valid ASCII characters;


A MIME message that consists of may be a regular text and
can be encoded using 7-bit ASCII.




























































































Tuesday, March 7, 2017

LearnersChoice: Heap Sort: It is like a comparison based sorting, it is the improvement of selection sort. Heap sort is divide the elements into two regions so...

Sunday, March 5, 2017


Java Strings



Strings are widely used in Java programming. A string is a sequence of characters or simply says a character array. Strings are treated as Objects.
The Java platform provides the String class to create and manipulate strings.




How to create a String:




The most direct way to create a string is to write:

String greeting = "Hello world!";

Whenever it encounters a string literal in your code, the compiler creates a String object with its value in this case,

"Hello world!'.

As with any other object, you can create String objects by using the new keyword and a constructor.

The String class has eleven constructors that allow you to provide the initial value of the string using different sources, such as an array of characters.



public class StringDemo{


public static void main(String args[]){

char[] helloArray = { 'h', 'e', 'l', 'l', 'o', '.'};

String helloString = new String(helloArray);

System.out.println(helloString );

}

}

The above code snippet gives the output hello





“The String class is immutable, so that once it is created a String object cannot be changed. The String class has a number of methods, some of which will be discussed below, that appear to modify strings. Since strings are immutable, what these methods really do is create and return a new string that contains the result of the operation”



Methods used to obtain information about an object are known as accessor methods. One accessor method that you can use with strings is the length() method, which returns the number of characters contained in the string object.


After the following two lines of code have been executed, len equals 17:



String palindrome = "Dot saw I was Tod";

int len = palindrome.length();



String Concatenation



Concatenating means combine two strings one at the end of the other.

In strings concat(String str) is a method used to concatenate the strings.

The String class includes a method for concatenating two strings:


string1.concat(string2);


This returns a new string that is string1 with string2 added to it at the end.


You can also use the concat() method with string literals, as in:


"My name is ".concat("Rumplestiltskin");


Strings are more commonly concatenated with the + operator, as in


"Hello," + " world" + "!"


which results in


"Hello, world!"


The + operator is widely used in print statements. For example:


String string1 = "saw I was ";

System.out.println("Dot " + string1 + "Tod");


which prints


Dot saw I was Tod


Such a concatenation can be a mixture of any objects. For each object that is not a String, its toString() method is called to convert it to a String.