Monday 22 August 2011

STRING SPLITING IN JAVA

,
THIS PROGRAM SEPARATE NAME AND NO
CODE:
package javaapplication2;
import java.io.*;

public class Main {

    public static void main(String[] args) throws IOException {

        BufferedReader str = new BufferedReader(new InputStreamReader(System.in));
        String user = new String();
        String temp = new String();
        System.out.println("Enter String:");


        user = str.readLine();

        String[] result = user.split("#");
      String[] name = null;
        String[] number = null;
        int totNum = Integer.parseInt(result[0]);
      //  System.out.println(totNum);
        name = new String[totNum+1];
        number = new String[totNum+1];

        for (int i = 1; i <= totNum; i++) {
           
            name[i]=result[i].split("~")[0];
            number[i]=result[i].split("~")[1];

        }
        System.out.println("Name List:");
for (int i = 1; i <= totNum; i++) {
          
           System.out.println(name[i]);
          
    }
        System.out.println("Number List:");
     for (int i = 1; i <= totNum; i++){
        
    System.out.println(number[i]);
        }
}
}

MOBILE NO CHECK IN JAVA

,
package javaapplication4;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

     public static void main(String[] args) throws IOException{

    String str1=new String();
    String str2=new String();
    BufferedReader str = new BufferedReader(new InputStreamReader(System.in));

    System.out.println("Enter Mobile No:");
    str1=str.readLine();
    System.out.println("Enter again:");
    str2=str.readLine();
    MobileCheck ank=new MobileCheck(str1, str2);

    }

}

class MobileCheck {
    String s1,s2;

    public MobileCheck(String str1,String str2) {
        s1=str1;
        s2=str2;
        int i=0;
      //  System.out.println(s1.startsWith(String.valueOf(0)));
        while(s1.startsWith(String.valueOf(0))){

            s1=s1.substring(i);
          //  System.out.println(s1);
            i++;
        }
        while(s2.startsWith(String.valueOf(0))){

            s2=s2.substring(i);
            i++;
        }

        if(s1.length()==s2.length()){
            System.out.println("mobile no is "+s1.equals(s2));
        }
        else if(s1.length()>s2.length()){

            i=s1.length()-s2.length();
            s1=s1.substring(i);
            System.out.println("Mobile no is "+s1.equals(s2));
                    }
        else{
            i=s2.length()-s1.length();
            s2=s2.substring(i);
            System.out.println("Mobile no is "+s1.equals(s2));
        }
    }


}

LEX:PROGRAM TO RECOGNIZE A STRING WITH THREE COSECUTIVE 0’s

,
PROGRAM TO RECOGNIZE A STRING WITH THREE COSECUTIVE 0’s
 Algorithm:-
 begin
if string=[0-9]*000[0-9]*
then
printf “Algorithm:-
 string accepted”
else
printf “string rejected”
end
 Program:-
 LEX program to recognize a string with  three consecutive 0’s

%%
[0-9]*000[0-9]* { printf(“string accepted”);}
[0-9]* { printf(“string rejected”);}
 %%
 main()
{
yylex();
}\
int yywrap()
{
return 1;
}
 OUTPUT:
 $./a.out
345000
string accepted
34560
String is rejected

LEX:PROGRAM TO RECOGNIZE STRINGS ENDING IN 00

,
  • PROGRAM TO RECOGNIZE STRINGS ENDING IN 00
 Algorithm:-
        begin
        if string=[0-9]*00
        then
        printf “string accepted”
        else
        printf”string rejected”
        end
3. LEX program to recognize strings ending in 00
 %%
[0-9]*00{printf(“string accepted”);
[0-9]*{printf(“string rejected”);}
%%
main()
{
yylex();
}
int yywrap()
{
return 1;
}
Output:

$./a.out
10100
String accepted
34560
String rejected

LEX:PROGRAM TO COUNT THE NUMBER OF LINES IN THE GIVEN INPUT

,
  PROGRAM TO COUNT THE NUMBER OF LINES IN THE GIVEN INPUT
 Algorithm:-
         begin
         num_lines=0
         num_chars=0
         if new line
         then num_lines++
         end
PROGRAM:
 LEX program to count the number of lines in a given input
 %{
int num_lines=0;
%}
%%
\n    ++num_lines;
%%
main()
{
yylex();
printf(“no of lines=%d”,num_lines);
}
int yywrap()
{
return num_lines;
}
 Output:
 $./a.out
abcd
1234
^d
No.of lines=2

LEX program to count number of vowels and consonants in a given input string

,
1 . PROGRAM TO IDENTIFY VOWELS AND CONSONANTS GIVEN AS  INPUT

 Algorithm:-

         begin

         if  a,e,I,o,u      or   A,E,I,O,U

         then

         printf “It is a vowel”

         else

         printf “It is a consonant”

         end

1.LEX program to count number of vowels and consonants in a given input string

%%

[aeiouAEIOU] {printf(“it is vowel”);}

[a-zA-Z] {printf(“it is consonant”);}

%%

main()

{

yylex();

}

int yywrap()

{

return 1;

}



Output:

$./a.out

a

it is a vowel

g

it is a consonant

Monday 15 August 2011

PART-II ADVANCED PROCESSOR 8086 PROGRAMS

,
                                                       Microprocessor 8086 Programs
                                                                  DOWNLOAD LINK:
 PROGRAMS:
PRESENTAION
SOFTWARE

TO RUN THE PROGRAM TASM SOFTWARE IS REQUIRED

PL/SQL SOURCE CODE

,
PL/SQL (Procedural Language/Structured Query Language) is Oracle Corporation's procedural extension language for SQL and the Oracle relational database. PL/SQL's general syntax resembles that of Ada or Pascal.
PL/SQL is one of three key programming languages embedded in the Oracle Database, along with SQL itself and Java.
PL/SQL program units (essentially code containers) can be compiled into the Oracle database. Programmers can thus embed PL/SQL units of functionality into the database directly. They also can write scripts containing PL/SQL program units that can be read into the database using the Oracle SQL*Plus tool.
Once the program units have been stored into the database, they become available for execution at a later time.
While programmers can readily embed Data Manipulation Language (DML) statements directly into their PL/SQL code using straight forward SQL statements, Data Definition Language (DDL) requires more complex "Dynamic SQL" statements to be written in the PL/SQL code. However, DML statements underpin the majority of PL/SQL code in typical software applications.
In the case of PL/SQL dynamic SQL, early versions of the Oracle Database required the use of a complicated Oracle DBMS_SQL package library. More recent versions have however introduced a simpler "Native Dynamic SQL", along with an associated EXECUTE IMMEDIATEsyntax.
CLICK HERE TO DOWNLOAD:



VISIT ANOTHER BLOG FROM HERE



Saturday 6 August 2011

BANKING PROJECT IN JAVA

,
 THIS PROJECT IS DEVELOP IN JAVA.
FOR THIS YOU HAVE REQUIRED NetBeans AND JDK6.1.
DOWNLOAD SOURCE CODE:
                                                          DOWNLOAD LINK:

                         http://www.ziddu.com/download/15950668/Banking.rar.html


IF ANY PROBLEM WRITE IN COMMENT BOX.