Tuesday, December 30, 2014

Display your name using Graphics

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"");
line(40,20,30,40);
line(10,20,30,40);
delay(30);
line(45,20,35,40);
line(40,30,50,30);
line(45,20,65,40);
delay(30);
line(70,20,70,40);
arc(70,30,270,90,12);
delay(30);
line(87,20,87,40);
delay(30);
line(90,20,110,40);
line(120,20,110,40);
delay(30);
line(124,20,124,40);
line(124,20,133,20);
line(124,30,133,30);
line(124,40,133,40);
delay();
line(139,20,139,40);
line(139,40,144,40);
delay();
line(146,40,156,20);
line(176,40,156,20);
line(151,30,166,30);
delay(30);
line(180,40,180,20);
line(180,20,190,40);
line(190,40,190,20);


circle(10,73,5);
arc(22,75,0,180,15);
line(37,75,44,75);
line(44,55,44,75);

line(50,75,50,55);
line(50,75,75,75);
arc(68,75,300,180,6);

arc(90,65,90,270,10);
circle(90,58,2);
circle(90,73,2);

circle(100,70,5);
arc(110,75,0,180,15);
line(125,75,135,75);
line(135,75,135,55);

circle(145,70,5);
arc(155,75,30,180,15);
arc(177,65,210,30,10);

circle(197,68,7);
circle(216,68,7);
circle(216,56,1);
line(197,61,235,61);
line(233,75,233,60);
getch();
}

Friday, November 21, 2014

Data Communication Networks Programs in Java ( Simple Chat application,File Transfer,Remote command execution,Sliding Window,Stop and Wait,Unix Socket,Windows Socket ) By Vadivelan Udayakumar


Simple Chat Application :

Client Side:

import java.net.*;
import java.io.*;
class client
{
public static void main(String[] args)throws Exception
{
String str;
Socket s=new Socket("localhost",1600);
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());
DataInputStream d=new DataInputStream(System.in);
while(true)
{
str=d.readLine();
ps.println("Client : "+str);
str=dis.readLine();
System.out.println(str);
}
}

}

Server side:

import java.net.*;
import java.io.*;
class server
{
public static void main(String[] args)throws Exception
{
String str;
ServerSocket ss=new ServerSocket(1600);
Socket s=ss.accept();
System.out.println("Server Ready");
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());
DataInputStream d=new DataInputStream(System.in);
while(true)
{
str=dis.readLine();
System.out.println(str);
str=d.readLine();
ps.println("Server : "+str);
}
}

}

..................................................................................................................................................................

file transfer using TCP/IP

In this you are gona send a file named velan.txt in server to vadi.txt in client side . You shd priorly hav a file velan.txt

Client side:

 import java.net.*;
import java.io.*;
class client
{
public static void main(String[] args)throws Exception
{
byte[] str=new byte[1024];
Socket s=new Socket("localhost",7);
DataInputStream dis=new DataInputStream(s.getInputStream());
FileOutputStream fos=new FileOutputStream("vadi.txt");
while(true)
{
if(dis.read(str)!=-1)
fos.write(str);
else
break;
}
}
}


Server side:

import java.net.*;
import java.io.*;
class server
{
public static void main(String[] args)throws Exception
{
byte[] str=new byte[1024];
ServerSocket ss=new ServerSocket(7);
Socket s=ss.accept();
DataOutputStream ps=new DataOutputStream(s.getOutputStream());
FileInputStream fis=new FileInputStream("velan.txt");
while(true)
{
fis.read(str);
ps.write(str);
if(fis.read(str)==-1)
break;

}
}

}

..................................................................................................................................................................


Remote Command Execution:

Sender side:

import java.io.*;
import java.lang.*;
import java.net.*;
class sender
{
public static void main(String args[])throws Exception
{
Socket s=new Socket("localhost",1600);
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());
DataInputStream ss=new DataInputStream(System.in);
while(true)
{
System.out.println("Enter the Command to send:");
String str=ss.readLine();
ps.println(str);
str=dis.readLine();
System.out.println(str);
}
}

}

Receiver side:

import java.io.*;
import java.net.*;
import java.lang.*;
class receiver
{
public static void main(String args[])throws Exception 
{
ServerSocket ss=new ServerSocket(1600);
Socket s=ss.accept();
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());
while(true)
{
Runtime r=Runtime.getRuntime();
String str=dis.readLine();
r.exec(str);
ps.println("Command Executed Successfully");
}
}

}

..................................................................................................................................................................

Sliding Window :

Server side :

import java.net.*;
import java.io.*;
class server
{
public static void main(String[] args)throws Exception
{
String str;
int n;
ServerSocket ss=new ServerSocket(1600);
Socket s=ss.accept();
System.out.println("Server Ready");
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());
DataInputStream d=new DataInputStream(System.in);
while(true)
{
System.out.println("Enter the window size:");
n=Integer.parseInt(d.readLine());
ps.println(String.valueOf(n));
while(n>0)
{
str=d.readLine();
ps.println(str);
n--;
}
str=dis.readLine();
System.out.println("Acknowledgement Received For "+str+" Packets");
}
}

}


Client side:

import java.net.*;
import java.io.*;
class client
{
public static void main(String[] args)throws Exception
{
String str;
Socket s=new Socket("localhost",1600);
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());
DataInputStream d=new DataInputStream(System.in);
while(true)
{
int n=Integer.parseInt(dis.readLine());
int i=0;
while(n>0)
{
i++;
str=dis.readLine();
System.out.println("Received : "+str);
n--;
}
ps.println(String.valueOf(i));
}
}

}

................................................................................................................................................................

Stop and Wait protocol:

Server side:

import java.net.*;
import java.io.*;
class server
{
public static void main(String[] args)throws Exception
{
String str;
ServerSocket ss=new ServerSocket(1600);
Socket s=ss.accept();
System.out.println("Server Ready");
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());
DataInputStream d=new DataInputStream(System.in);
int k=1;
while(true)
{
if(k==0)
k=1;
else
k=0;
System.out.println("Enter the Data To send:");
str=d.readLine();
str=str+String.valueOf(k);
ps.println("Server : "+str);
int i=Integer.parseInt(dis.readLine());
if(i==1)
System.out.println("Acknowledgement Received");
else
System.out.println("Acknowledgement not Received Send the Packet again");
}
}

}

Client side:

import java.net.*;
import java.io.*;
class clent
{
public static void main(String[] args)throws Exception
{
String str;
Socket s=new Socket("localhost",1600);
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());
DataInputStream d=new DataInputStream(System.in);
while(true)
{
str=dis.readLine();
System.out.println(str);
ps.println(String.valueOf(1));
}
}

}

................................................................................................................................................................

Unix Socket programming:

Server Side:

import java.net.*;
import java.io.*;
class server
{
public static void main(String[] args)throws Exception
{
String str;
int port=1600,ch=0;

System.out.println("port address is 1600(default) enter 1 to change it else enter 0:");
DataInputStream d=new DataInputStream(System.in);
ch=Integer.parseInt(d.readLine());
if(ch==1)
port=Integer.parseInt(d.readLine());
ServerSocket ss=new ServerSocket(port);
Socket s=ss.accept();
System.out.println("Server Reading");
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());
while(true)
{
if((str=dis.readLine())!=null)
System.out.println(str);
else
{System.out.println("Connection Terminated");break;}
str=d.readLine();
ps.println("Server : "+str);
}
}

}


Client Side:

import java.net.*;
import java.io.*;
class client
{
public static void main(String[] args)throws Exception
{
String str;
int port=1600,ch=0;

System.out.println("port address is 1600(default) enter 1 to change it else enter 0:");
DataInputStream d=new DataInputStream(System.in);
ch=Integer.parseInt(d.readLine());
if(ch==1)
port=Integer.parseInt(d.readLine());

Socket s=new Socket("localhost",port);
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());

while(true)
{
if((str=d.readLine())!=null)
ps.println("Client : "+str);
else
{
System.out.println("Connection Terminated");
break;
}
str=dis.readLine();
System.out.println(str);

}
}

}

.................................................................................................................................................................

Windows Socket Programming:

Server Side:

import java.net.*;
import java.io.*;
class server
{
public static void main(String[] args)throws Exception
{
String str;
ServerSocket ss=new ServerSocket(231);
Socket s=ss.accept();
System.out.println("Server Reading");
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());
DataInputStream d=new DataInputStream(System.in);
while(true)
{
str=dis.readLine();
System.out.println(str);
str=d.readLine();
ps.println("Server : "+str);
}
}

}


Client Side:

import java.net.*;
import java.io.*;
class client
{
public static void main(String[] args)throws Exception
{
String str;
Socket s=new Socket("localhost",231);
DataInputStream dis=new DataInputStream(s.getInputStream());
PrintStream ps=new PrintStream(s.getOutputStream());
DataInputStream d=new DataInputStream(System.in);
while(true)
{
str=d.readLine();
ps.println("Client : "+str);
str=dis.readLine();
System.out.println(str);
}
}

}

...................................................................................................................................................................

Saturday, August 23, 2014

FLAMES PROGRAM IN C

Flames.....
Ppl check your relationship with others:

F-Friend
L-love
A-affection
M-marriage
E-enemy
S-Sister:-P


#include<stdio.h>
#include<conio.h>
void main()
{
int m,i,d,j,l1,l2,c=0;
char name1[20],name2[20],name3[20]="FLAMES";
clrscr();
printf("\n\nenter the name:");
scanf("%s%s",name1,name2);
for(i=0;name1[i]!='\0';i++);
l1=i;
for(j=0;name2[j]!='\0';j++);
l2=j;
printf("L1=%d L2=%d",l1,l2);
for(i=0;i<l1;i++)
for(j=0;j<l2;j++)
{
if(name1[i]==name2[j])
{
name1[i]='-';name2[j]='-';break;}
}
printf("\n\n\n%s<--->%s",name1,name2);
for(i=0,j=0;i<l1||j<l2;i++,j++)
{
if(name1[i]!='-'&&name1[i]!='\0')
c++;
if(name2[j]!='-'&&name2[j]!='\0')
c++;
}
printf("\n\nNo of terms is:%d",c);
m=5;
for(d=0,i=0,j=0;;)
{
if(name3[d]!='/')
i++;
if(i%c==0&&name3[d]!='/')
{
name3[d]='/';
printf("\n%s",name3);
j++;
printf("\n\n%d",j);
}
if(j==m)
break;
d++;
if(d==6)
d=0;
}
printf("\n\nAnswer:::::%s",name3);
getch();
}

Tuesday, July 8, 2014

Stock management in c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
    class items
    {
        public string[] itemname = new string[100];
        public int[] units = new int[100];
        public int[] unitprice = new int[100];
        public int index;
        public items()
        {
            index = 0;
        }
    }

    class stockmanagement
    {
        static void Main(string[] args)
        {
            items men = new items();
            items women = new items();
            items child = new items();
            items boys = new items();
            items girls = new items();
            int choice;
            do
            {
                Console.WriteLine("Enter the Category:\n1.Men\n2.Women\n3.Boys\n4.Girls\n5.Child");
                int ch = Convert.ToInt16(Console.ReadLine());
               
                switch (ch)
                {
                    case 1:
                        Console.WriteLine("Enter The ItemName:");
                     
                        men.itemname[men.index] = Console.ReadLine();
                        Console.WriteLine("Enter The no. of units:");
                        men.units[men.index] = Convert.ToInt16(Console.ReadLine());
                        Console.WriteLine("Enter The no. of unitprice:");
                        men.unitprice[men.index] = Convert.ToInt16(Console.ReadLine());
                        men.index++;
                        break;
                    case 2:
                        Console.WriteLine("Enter The ItemName:");
                        women.itemname[women.index] = Console.ReadLine();
                        Console.WriteLine("Enter The no. of units:");
                        women.units[women.index] = Convert.ToInt16(Console.ReadLine());
                        Console.WriteLine("Enter The no. of unitprice:");
                        women.unitprice[women.index] = Convert.ToInt16(Console.ReadLine());
                        women.index++;
                        break;
                    case 3:
                        Console.WriteLine("Enter The ItemName:");
                        boys.itemname[boys.index] = Console.ReadLine();
                        Console.WriteLine("Enter The no. of units:");
                        boys.units[boys.index] = Convert.ToInt16(Console.ReadLine());
                        Console.WriteLine("Enter The no. of unitprice:");
                        boys.unitprice[boys.index] = Convert.ToInt16(Console.ReadLine());
                        boys.index++;
                        break;
                    case 4:
                        Console.WriteLine("Enter The ItemName:");
                       
                        girls.itemname[girls.index] = Console.ReadLine();
                        Console.WriteLine("Enter The no. of units:");
                        girls.units[girls.index] = Convert.ToInt16(Console.ReadLine());
                        Console.WriteLine("Enter The no. of unitprice:");
                        girls.unitprice[girls.index] = Convert.ToInt16(Console.ReadLine());
                        girls.index++;
                        break;
                    case 5:
                        Console.WriteLine("Enter The ItemName:");
                        child.itemname[child.index] = Console.ReadLine();
                        Console.WriteLine("Enter The no. of units:");
                        child.units[child.index] = Convert.ToInt16(Console.ReadLine());
                        Console.WriteLine("Enter The no. of unitprice:");
                        child.unitprice[child.index] = Convert.ToInt16(Console.ReadLine());
                        child.index++;
                        break;
                }
                Console.WriteLine("enter 1 to continue adding");
                choice = Convert.ToInt16(Console.ReadLine());
            } while (choice == 1);
            Console.WriteLine("\n\n\n");
            Console.WriteLine("The Stocks are:\n men:");
            for (int i = 0; i < men.index; i++)
                Console.WriteLine("ItemName: " + men.itemname[i] + " units :" + men.units[i] + " untprice: " + men.unitprice[i]);
            Console.WriteLine("\n\n\n");
            Console.WriteLine("The Stocks are:\n Women:");
            for (int i = 0; i < women.index; i++)
                Console.WriteLine("ItemName: " + women.itemname[i] + " units :" + women.units[i] + " untprice: " + women.unitprice[i]+"\n");
            Console.WriteLine("\n\n\n");
            Console.WriteLine("The Stocks are:\n Boys:");
            for (int i = 0; i < boys.index; i++)
                Console.WriteLine("ItemName: " + boys.itemname[i] + " units :" + boys.units[i] + " untprice: " + boys.unitprice[i]+"\n");
            Console.WriteLine("\n\n\n");
            Console.WriteLine("The Stocks are:\n girls:");
            for (int i = 0; i < girls.index; i++)
                Console.WriteLine("ItemName: " + girls.itemname[i] + " units :" + girls.units[i] + " untprice: " + girls.unitprice[i]+"\n");
            Console.WriteLine("\n\n\n");
            Console.WriteLine("The Stocks are:\n child:");
            for (int i = 0; i < child.index; i++)
                Console.WriteLine("ItemName: " + child.itemname[i] + " units :" + child.units[i] + " untprice: " + child.unitprice[i]+"\n");
            Console.WriteLine("\n\n\n");
            Console.ReadLine();
        }
       
    }
}

Threads in c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
/* thread is a light weight process,A process consists of many threads,Threads help us to accomplish the task of multitasking,*/
/* the various thread functions are Start(),Sleep(milliseconds),Abort(),Suspend(),Resume()*/
namespace ConsoleApplication5
{
    class thread    {
        static void Main(string[] args)
        {
            Thread t1 = new Thread(fun1);
            Thread t2 = new Thread(fun2);
            t1.Start();
            t2.Start();
           

           
            Console.Read();
        }

        public static void fun1()
        {
            for (int i = 0; i < 5000; i++)
            {
                Console.WriteLine("Hi");
                Thread.Sleep(2000);
            }
        }
        public static void fun2()
        {
            for (int i = 0; i < 500; i++)
            {
                Console.WriteLine("hello");
                Thread.Sleep(1000);
            }
        }
    }
}

Producer Consumer Problem Simple using c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
namespace ConsoleApplication6
{
    class producerconsumer
    {
        static int buf;
        static void Main(string[] args)
        {
            buf = 0;
            Thread t1 = new Thread(consumer);
            Thread t2 = new Thread(producer);
            t1.Start();
            t2.Start();

        }
        static void consumer()
        {
            for (int x = 1; x < 5000; )
                if (buf > 0)
                {
                    buf--;
                    Thread.Sleep(2000);
                    Console.WriteLine("Consumer" + x++);
                }
                else
                {
                    Console.WriteLine("Consumer Waiting");
                    Thread.Sleep(1000);
                }
        }
        static void producer()
        {
            for (int x = 1; x < 5000; )
                if (buf < 4)
                {
                    buf++;
                    Thread.Sleep(1000);
                    Console.WriteLine("producer" + x++);
                }
                else
                {
                    Console.WriteLine("Producer waiting");
                    Thread.Sleep(1000);
                }

        }
    }

    }

Abstract class in c#

using System;
class overriding
{
public static void Main()
{
classderived b=new classderived();
abstractclass i=b;
i.fun();//calls the derived class method
}
}
abstract class abstractclass
{
public abstract void fun();//fully virtual method,as it doesnot have any definition
}
class classderived:abstractclass
{
public override void fun()
{
Console.WriteLine("This method is derived class method");
}
}

File handling in c#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace ConsoleApplication7
{
    class Program
    {
        static void Main(string[] args)
        {
            if(File.Exists("D:\\c#\\vadi.txt"))
                Console.WriteLine("File already exits");
            else{
            File.Create("D:\\c#\\vadi.txt");
            Console.WriteLine("created");
            }
            int ch;
            do{
            Console.WriteLine("Enter ypur choice:\n1.Read\n2.Write\n3.Append");
            ch=Convert.ToInt16(Console.ReadLine());
            switch(ch)
            {
                case 1:
                    Console.WriteLine("Reading the file");
                    string s=File.ReadAllText("D:\\c#\\vadi.txt");
                    string[] st = new string[10];
                    st=File.ReadAllLines("D:\\c#\\vadi.txt");
                    for(int m=0;m<st.Length;m++)
                    Console.WriteLine(st[m]);
                    Console.WriteLine(s);
                    break;
                case 2:
                    Console.WriteLine("Enter the String to be entered:");
                    string str=Console.ReadLine();
                    File.WriteAllText("D:\\c#\\vadi.txt",str);
                    break;
                case 3:
                    Console.WriteLine("Enter the contents to be appended:");
                    string str1=Console.ReadLine();
                    File.AppendAllText("D:\\c#\\vadi.txt",str1);
                    break;
            }
        }while(true);

       

            Console.Read();
        }
        }
    }

Exception handling in c#

using System;
class excep
{
public static void Main()
{
int a;
try
{
Console.Write("Enter the value for a:");
a=Convert.ToInt32(Console.ReadLine());
if(a==5)
throw new myexp();
else
Console.WriteLine("a value is not 5");
Console.WriteLine("This lines will b skipped if throw is executed");
 }
catch(myexp e)
{
Console.WriteLine("A value is 5 "+e.msg());
}
finally
{
Console.WriteLine("This stmt ll execute finally after catch or after try block");
}
}
}
class myexp:Exception
{
public string msg()
{
return "Vadivelan";
}
}

Super Keyword usages in java

Example 1:
import java.io.*;
//superkeyword can be used to call the base class ((paramerised))constructor as well as to use the data members/member functions of the base class from the derived class
class superkeyword2
{
public static void main(String[] args)
{
derived2 d3=new derived2();
d3.function();
}
}
class base
{
void basefun(int x)
{
System.out.println("baseclass function called");
}
}
class derived extends base
{
void derivedfun()
{
super.basefun(10);//calls base classs function
System.out.println("this is derived class method...");
}
}
class derived2 extends derived
{
void function()
{
System.out.println("this is derived2 class method...gona call base class method");
super.derivedfun();//calls derived class which is the baseclass of derived class
derivedfun();//this just calls function within this same class
}
void derivedfun()
{
super.basefun(10);//calls base classs function
System.out.println("this is derived 2222222 class method...");
}
}



Example 2:

import java.io.*;
//superkeyword can be used to call the base class ((paramerised))constructor as well as ro use the data members/member functions of the base class from the derived class
class superkeyword
{
public static void main(String[] args)
{
derived2 d=new derived2();//calls the default costructors....
derived2 d1=new derived2('a');//ths calls the paramerised constructor of the derived 2...parameterised constructor can also call the default constructor of the base class or manually we can also use super()->for default constructor of the base class.....super(..) for calling any other para constructors of the base class
}
}
class base
{
base()
{
System.out.println("The default constructor of the base class");
}
base(int x)
{
System.out.println("The parameterised constructor of the base class");
}
}
class derived1 extends base
{
derived1()
{
super(10);//this calls the parameterised constructor of the base class// if ths stmt was not found thn the default constuctor would hav got called.....
System.out.println("the default constructor of the derived class");
}
derived1(int x,int y)
{
System.out.println("the parameterised constructor of the derived class");
}
}
class derived2 extends derived1
{
derived2()
{
System.out.println("the default constructor of the derived2 class");
}
derived2(char a)
{
super(10,20);//this calls the parameterised constructor of the derived1 class// if ths stmt was not found thn the default constuctor would hav got called.....
System.out.println("the parameterised constructor of the derived2 class");
}
}




Overriding concept in java

import java.io.*;
class overridding
{
//over riding is the concept in which the derived classes also contain member function of same names and differ in no. or type of parameters..
public static void main(String[] args)
{
System.out.println("in main function");
derived3 d3=new derived3();
d3.function();
d3.function(5);
d3.function(5,10);
}
}
class base
{
void function()
{
System.out.println("in base function");
}
}
class derived2 extends base
{
void function(int a,int b)
{
System.out.println("in 1st derived function");
}
}
class derived3 extends derived2
{
void function(int x)
{
System.out.println("in 2 nd derived function");
}
}

Screen capture using java

/* save ths file as main.java then run it*/
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import javax.imageio.ImageIO;
import java.io.File;

class main
{
public static void main(String[] args)throws Exception
 {
captureScreen("vadi.png");
}
public static void captureScreen(String fileName) throws Exception {

   Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
   Rectangle screenRectangle = new Rectangle(screenSize);
   Robot robot = new Robot();
   BufferedImage image = robot.createScreenCapture(screenRectangle);
   ImageIO.write(image, "png", new File(fileName));

}
}

Arrays in java

//By Vadivelan.U (Vadivelan Udayakumar)

import java.io.*;
import java.util.*;//for using scanner class

class array
{
public static void main(String[] args)
{
int[] a=new int[10];//now a is an integer array of size 10

int[] c;//no memory is still allocated for c array

c=new int[50];//memory gets allocated for c array

int[] b=a;//now a and b have same memory and they have samelengths....any changes done over array b affects a array..

int[] d={10,20,30};//declaration allowed

int[] m=new int[]{5,10,15};//declaration allowed

int[] e;//no memory allocated

//By Vadivelan.U (Vadivelan Udayakumar)

System.out.println("Enter the array size of e array:");
Scanner s=new Scanner(System.in);
int n=s.nextInt();
e=new int[n];//memorysize gets allocated as per the user needs


//By Vadivelan.U (Vadivelan Udayakumar)

for(int i=0;i<10;i++)
a[i]=i;//array initialization

for(int i=0;i<10;i++)
System.out.println("a["+i+"] = "+a[i]);

fun(a);//passing array as a parameter => pass by reference

System.out.println("\n\n\n\n");

for(int i=0;i<10;i++)
System.out.println("a["+i+"] = "+a[i]);//array a values changes based on the changes done in the formal parameters..

int[] b1=fun2();//a function can return an array

for(int i=0;i<b1.length;i++)
System.out.println("b1["+i+"] = "+b1[i]);//the returned array gets printed..

//By Vadivelan.U (Vadivelan Udayakumar)

int[] d1=new int[20];
d1=a;//now implicitly d1 gets converted to an array of length 10 and has the same address of that of a array

System.out.println("\n\n\n\n");

for(int i=0;i<10;i++)
System.out.println("d1["+i+"] = "+d1[i]);

}

//By Vadivelan.U (Vadivelan Udayakumar)



static void fun(int[] x)//a function which accepts array as a parameter...now x array and a array have same memory address
{
for(int i=1;i<=10;x[i-1]=i,i++);
}





static int[] fun2()//a function which is gona return an array..
{
int[] a={10,20,30};
return a;// the address of a array is now passed to b1......so if b1 is already allocated with memory also its a waste..coz anyways b1 is gona work in the memory of a after the function call.......
}


//By Vadivelan.U (Vadivelan Udayakumar)


}  

Android Operating System Paper Presentation


Topic:
Android Operating System


Developed by,


Students Name with Reg No
Vadivelan.U
S141144300413


Description: C:\Users\MRuser\Desktop\niit.png








    Android, Inc. was founded in Palo Alto, California in October 2003 by Andy Rubin.
Android is an operating system based on the Linux kernel with a user interface based on direct manipulation, designed primarily for touchscreen mobile devices such as smartphones and tablet computers. The operating system uses touch inputs that loosely correspond to real-world actions, like swiping, tapping, pinching, and reverse pinching to manipulate on-screen objects, and a virtual keyboard. Despite being primarily designed for touchscreen input, it also has been used in televisions, games consoles, digital cameras, and other electronics.
As of 2011, Android has the largest installed base of any mobile OS and as of 2013, its devices also sell more than Windows, iOS and Mac OS devices combined. As of July 2013 the Google Play store has had over 1 million Android apps published, and over 50 billion apps downloaded. A developer survey conducted in April–May 2013 found that 71% of mobile developers develop for Android .
Android's source code was released by Google under open source licenses, although most Android devices ultimately ship with a combination of open source and proprietary software. Initially developed by Android, Inc., which Google backed financially and later bought in 2005.
Since April 2009, Android versions have been developed under a confectionery-themed code name and released in alphabetical order:
v  Cupcake (1.5)
v  Doughnut (1.6)
v  Eclair (2.0–2.1)
v  Froyo (2.2–2.2.3)
v  Gingerbread (2.3–2.3.7)
v  Honeycomb (3.0–3.2.6)
v  Ice Cream Sandwich (4.0–4.0.4)
v  Jelly Bean (4.1–4.3.1)
v  KitKat (4.4–4.4.4)
v  Lollipop (4.5)





Ginger Bread(2.3) Improvements and new features

The new stuff in Android 2.3 includes:
·         New UI theme with simpler colour scheme
·         Redesigned on-screen keyboard
·         New copy-and-paste functionality
·         Better power management
·         Better application management
·         New downloads manager
·         Near-field communications (NFC) integration
·         SIP calling over the Internet
·         New camera app for accessing multiple cameras
·         Support for extra large screens (i.e. tablets)

Description: http://b2b.cbsimg.net/gallery/489829-486-400.png
The next Android: Screenshots of version 2.3, Gingerbread








Honeycomb(3.0) Improvements and new features
1.       Optimized Tablet UI - You will find this very interesting as the general layout of UI has extravagant space on the home screen for icons and widgets. With this well optimized Table UI you are free to accommodate many required things just on home screen
2.       Redesigned widgets – With the updated set of Android 3.0 UI widgets, it becomes easier for developers to add new content to their existing applications. The new UI widgets concentrate on bigger screens such as tablets and including the new holographic UI theme. Don’t miss out on the new widgets comprising a 3D stack, search box, a date/time picker, number picker, calendar, popup menu, and others.
3.       Elegant Notification Bar – You will find the notification bar at the bottom of the screen so as to offer quick access to notifications. Back, Home, and Recent Apps are the three buttons you will find on the System Bar. In the present System Bar there is a new “lights out Mode” which can be dimmed for full-screen viewing, for example videos.
4.       Customizable Home Screen – Home screen is more or less the similar to previous version on Android where you can add widgets, apps and shortcuts. However, when you are allowed to swipe between five different screens along with an awesome new 3D look for the home screen is definitely fun and this is what the new version offers!
5.       Action-bar – Action bar is placed at the top of the screen where users can access contextual options, navigation, widgets, or content.  This one is always present when any application is in use, however its content, theme, and other properties are handled by the application and not by the system.
6.        Redesigned Keyboard and Improved Copy/Paste – To make typing fast and accurate, Android 3.0 has a soft keyboard on larger screen size. These reshaped, repositioned and new keys (Tab key) are certainly welcomed by users that offer richer and more effective text input. Copy/paste now becomes simpler for users by just selecting a word by press-hold and then moving the selection area as needed by dragging a set of bounding arrows to new positions.
7.       Browser Enhancements – Browser enhancements include tabbed web pages, form auto-fill, bookmark syncing with Google Chrome, and private browsing. Other updated areas would include Browser, Contacts, Email and Camera that can be used more efficiently with your larger screen tablet.
8.       Visual multi-tasking – Users have had the benefit of multitasking in Android for now and latest version is even better. When you launch apps to handle multitask, you can make use of Recent Apps list in the System Bar to see and switch between one application to another. The System Bar also has the snapshot list that state when you viewed it last.
9.       Multiselect, Clipboard, and Drag-and-drop – This will be really convenient for developers when handling various items in lists or grids, where developer can offer a new multiselect mode to choose multiple item for one action. The new clipboard will let developers copy any type of data into and out of their applications. Further, neat drag-and-drop will help to easily manage and organize files.
10.   New Connectivity options – New APIs for Bluetooth A2DP and HSP let applications offer audio streaming and headset control. Support for Bluetooth insecure socket connection lets applications connect to simple devices that may not have a user interface.
11.   Support for Multi-core Processors – Android 3.0 is the first version of the platform designed to run on either single or multi-core processor architectures. Many other changes in the Dalvik VM, Bionic library, and elsewhere add support for symmetric multiprocessing in multicore environments. This will do nothing but help all the applications including those that are single-threaded.
12.  Hardware acceleration for 2D graphics – Android honeycomb offers a new hardware-accelerated OpenGL renderer, which offers a performance boost to many common graphics operations for applications running in the Android framework. When the renderer is enabled, most operations in Canvas, Paint, Xfermode, ColorFilter, Shader, and Camera are accelerated.


Android 4.0 (Ice Cream Sandwich) Improvements and new features

Refined, evolved UI

Focused on bringing the power of Android to the surface, Android 4.0 makes common actions more visible and lets you navigate with simple, intuitive gestures. Refined animations and feedback throughout the system make interactions engaging and interesting. An entirely new typeface optimized for high-resolution screens improves readability and brings a polished, modern feel to the user interface.
Virtual buttons in the System Bar let you navigate instantly to Back, Home, and Recent Apps. The System Bar and virtual buttons are present across all apps, but can be dimmed by applications for full-screen viewing. You can access each application's contextual options in the Action Bar, displayed at the top (and sometimes also at the bottom) of the screen.
Multitasking is a key strength of Android and it's made even easier and more visual on Android 4.0. The Recent Apps button lets you jump instantly from one task to another using the list in the System Bar. The list pops up to show thumbnail images of apps used recently — tapping a thumbnail switches to the app.
Rich and interactive notifications let you keep in constant touch with incoming messages, play music tracks, see real-time updates from apps, and much more. On smaller-screen devices, notifications appear at the top of the screen, while on larger-screen devices they appear in the System Bar.

Home screen folders and favorites tray

New home screen folders offer a new way for you to group your apps and shortcuts logically, just by dragging one onto another. Also, in All Apps launcher, you can now simply drag an app to get information about it or immediately uninstall it, or disable a pre-installed app.
On smaller-screen devices, the home screen now includes a customizable favorites tray visible from all home screens. You can drag apps, shortcuts, folders, and other priority items in or out of the favorites tray for instant access from any home screen.

Resizable widgets

Home screens in Android 4.0 are designed to be content-rich and customizable. You can do much more than add shortcuts — you can embed live application content directly through interactive widgets. Widgets let you check email, flip through a calendar, play music, check social streams, and more — right from the home screen, without having to launch apps. Widgets are resizable, so you can expand them to show more content or shrink them to save space.

New lock screen actions

The lock screens now let you do more without unlocking. From the slide lock screen, you can jump directly to the camera for a picture or pull down the notifications window to check for messages. When listening to music, you can even manage music tracks and see album art.

Quick responses for incoming calls

When an incoming call arrives, you can now quickly respond by text message, without needing to pick up the call or unlock the device. On the incoming call screen, you simply slide a control to see a list of text responses and then tap to send and end the call. You can add your own responses and manage the list from the Settings app.

Swipe to dismiss notifications, tasks, and browser tabs

Android 4.0 makes managing notifications, recent apps, and browser tabs even easier. You can now dismiss individual notifications, apps from the Recent Apps list, and browser tabs with a simple swipe of a finger.

Improved text input and spell-checking

The soft keyboard in Android 4.0 makes text input even faster and more accurate. Error correction and word suggestion are improved through a new set of default dictionaries and more accurate heuristics for handling cases such as double-typed characters, skipped letters, and omitted spaces. Word suggestion is also improved and the suggestion strip is simplified to show only three words at a time.
To fix misspelled words more easily, Android 4.0 adds a spell-checker that locates and underlines errors and suggests replacement words. With one tap, you can choose from multiple spelling suggestions, delete a word, or add it to the dictionary. You can even tap to see replacement suggestions for words that are spelled correctly. For specialized features or additional languages, you can now download and install third-party dictionaries, spell-checkers, and other text services.

Powerful voice input engine

Android 4.0 introduces a powerful new voice input engine that offers a continuous "open microphone" experience and streaming voice recognition. The new voice input engine lets you dictate the text you want, for as long as you want, using the language you want. You can speak continously for a prolonged time, even pausing for intervals if needed, and dictate punctuation to create correct sentences. As the voice input engine enters text, it underlines possible dictation errors in gray. After dictating, you can tap the underlined words to quickly replace them from a list of suggestions.

Control over network data

Mobile devices can make extensive use of network data for streaming content, synchronizing data, downloading apps, and more. To meet the needs of you with tiered or metered data plans, Android 4.0 adds new controls for managing network data usage.
In the Settings app, colorful charts show the total data usage on each network type (mobile or Wi-Fi), as well as amount of data used by each running application. Based on your data plan, you can optionally set warning levels or hard limits on data usage or disable mobile data altogether. You can also manage the background data used by individual applications as needed.

Designed for accessibility

A variety of new features greatly enhance the accessibility of Android 4.0 for blind or visually impaired users. Most important is a new explore-by-touch mode that lets you navigate without having to see the screen. Touching the screen once triggers audible feedback that identifies the UI component below; a second touch in the same component activates it with a full touch event. The new mode is especially important to support users on new devices that use virtual buttons in the System Bar, rather than dedicated hardware buttons or trackballs. Also, standard apps are updated to offer an improved accessibility experience. The Browser supports a script-based screen reader for reading favorite web content and navigating sites. For improved readability, you can also increase the default font size used across the system.

Rich and versatile camera capabilities

The Camera app includes many new features that let you capture special moments with great photos and videos. After capturing images, you can edit and share them easily with friends.
When taking pictures, continuous focus, zero shutter lag exposure, and decreased shot-to-shot speed help capture clear, precise images. Stabilized image zoom lets you compose photos and video in the way you want, including while video is recording. For new flexibility and convenience while shooting video, you can now take snapshots at full video resolution just by tapping the screen as video continues to record.
An improved Picture Gallery widget lets you look at pictures directly on the home screen. The widget can display pictures from a selected album, shuffle pictures from all albums, or show a single image. After adding the widget to the home screen, you can flick through the photo stacks to locate the image you want, then tap to load it in Gallery.

Sharing with screenshots

You can now share what's on your screens more easily by taking screenshots. Hardware buttons let them snap a screenshot and store it locally. Afterward, you can view, edit, and share the screen shot in Gallery or a similar app.
Cloud-connected experience
Android has always been cloud-connected, letting you browse the web and sync photos, apps, games, email, and contacts — wherever you are and across all of your devices. Android 4.0 adds new browsing and email capabilities to let you take even more with them and keep communication organized.

Face Unlock

Android 4.0 introduces a completely new approach to securing a device, making each person's device even more personal — Face Unlock is a new screen-lock option that lets you unlock your device with your face. It takes advantage of the device front-facing camera and state-of-the-art facial recognition technology to register a face during setup and then to recognize it again when unlocking the device. Just hold your device in front of your face to unlock, or use a backup PIN or pattern.

Android 4.3, Jelly Bean Improvements and new features
Description: http://www.android.com/images/nexus-7-4-3.jpg

Android 4.3, an even sweeter Jelly Bean, is available now on Nexus phones and tablets.
Restricted profiles: limit access to apps and content, at home with your family and at work. Bluetooth Smart support makes Android ready for a whole new class of mobile apps that connect to fitness sensors. Games look great thanks to the 3D realistic, high performance graphics powered by OpenGL ES 3.0.

Audio

·         Virtual surround sound - enjoy movies from Google Play with surround sound on Nexus 7 (2013 edition) and other Nexus devices.
Surround sound is powered by Fraunhofer Cingo™ mobile audio technology.

Dial pad

·         Autocomplete - just start touching numbers or letters and the dial pad will suggest phone numbers or names. To turn on this feature, open your phone app settings and enable “Dial pad autocomplete.”
Description: http://www.android.com/images/smart-dialer-animated_v2.gif

Graphics

·         OpenGL ES 3.0 - Android now supports the latest version of the industry standard for high performance graphics.
·         Wireless Display for Nexus 7 (2013 edition) and Nexus 10 - project from your tablet to a TV.

Internationalization and localization

·         Additional language support - Android is now translated in Africaans, Amharic (አማርኛ), Hindi (हिंदी), Swahili (Kiswahili), and Zulu (IsiZulu).
·         Hebrew, Arabic, and other RTL (right-to-left) - now supported in the home screen, settings, and Phone, People, and Keep apps.

Keyboard & input

·         Easier text input - an improved algorithm for tap-typing recognition makes text input easier.
·         Lower latency input for gamepad buttons and joysticks.

Location

·         Location detection through Wi-Fi - use Wi-Fi to detect location without turning on Wi-Fi all the time.

Networking

·         Bluetooth Smart support (a.k.a. Bluetooth Low-Energy) - devices like Nexus 4 and Nexus 7 (2013 edition) are now Bluetooth Smart Ready.
·         Bluetooth AVRCP 1.3 support - display song names on a car stereo.

Settings

·         Disabled apps tab - check which apps are disabled in Settings > Apps.

System

·         Restricted profiles - put your tablet into a mode with limited access to apps and content.
·         Setup wizard simplification - getting started on Android is easier thanks to the ability to correct previous input, and because of streamlined user agreements.
·         Faster user switching - switching users f
rom the lock screen is now faster.
·         Enhanced photo daydream - navigate through interesting albums.



Here is the ppt check it too: