Showing posts with label Programing. Show all posts
Showing posts with label Programing. Show all posts

Sunday, 23 June 2013

16. Assume that the information regarding the marks for all the subjects of a student in the last exam are available in a database, Develop a Servlet which takes the enrollment number of a student as a request parameter and displays the marksheet for the student.

0 comments
WTAD Practical - 16
Assume that the information regarding the marks for all the subjects of a student in
the last exam are available in a database, Develop a Servlet which takes the
enrollment number of a student as a request parameter and displays the marksheet for the student.
index.html


<HTML>
<HEAD>
<TITLE>WTAD.practical-16 @iAmLearningHere </TITLE>

</HEAD>
<BODY bgcolor="YellowGreen">
<h3> Result  </h3>
<hr>
<form name="frm1" action="display">
Enter Enrolment No :: <input type="text" name="en"> 
<input type="submit" Value="Get Result"">
</form>
</BODY>
</HTML>

Saturday, 22 June 2013

15. Assume that we have got three pdf files for the MCA-1 Syllabus, MCA-2 Syllabus and MCA-3 Syllabus respectively, Now write a Servlet which displays the appropriate PDF file to the client, by looking at a request parameter for the year (1, 2 or 3).

1 comments
WTAD Practical - 15
Write a Servlet to display parameters available on request.
index.html


<HTML>
<HEAD>
<TITLE>WTAD.practical-15 @iAmLearningHere </TITLE>
</HEAD>
<BODY bgcolor="YellowGreen">
<h3>DISPLAY Syllabus in pdf</h3>
<hr>
<form name="f1" action="display" method="get" >
MCA-1<br>
MCA-2<br>
MCA-3<br>
<input type="text" name="MCA" value="" />
<input type="submit" value="Show Syllabus" />
</form>
</BODY>
</HTML>

14. Write a Servlet which displays a message and also displays how many times the message has been displayed (how many times the page has been visited).

0 comments
WTAD Practical - 14
Write a Servlet which displays a message and also displays how many times the
message has been displayed (how many times the page has been visited).
WEB-INF/web.xml


<web-app>
<servlet>
<servlet-name>s14</servlet-name>
<servlet-class>VisitCount</servlet-class>
</servlet>
<!-- Servlet Mapping -->
<servlet-mapping>
<servlet-name>s14</servlet-name>
<url-pattern>/visit</url-pattern>
</servlet-mapping>
</web-app>

12. Write a Servlet to display parameters available on request.

0 comments
WTAD Practical - 12
Write a Servlet to display parameters available on request.
index.html


<HTML>
<HEAD>
<TITLE>WTAD.practical-12 @iAmLearningHere </TITLE>
</HEAD>
<BODY bgcolor="YellowGreen">
<h3>Display parameters available on request.</h3>
<hr>
<form name="f1" action="display" method="get" >
<!-- Enter Three Parameters Here -->
Source Name:<input type="text" name="nm"/><br />
Subject 1 &nbsp;&nbsp;&nbsp; : <input type="text" name="sub1" /><br />
Subject 2 &nbsp;&nbsp;&nbsp; : <input type="text" name="sub2" /><br />

<input type="submit" value="Send Parameters" />
</form>
</BODY>
</HTML>

Friday, 21 June 2013

11. Write a Servlet to display all the headers available from request.

1 comments
WTAD Practical - 11
Write a Servlet to display all the headers available from request.
WEB-INF/web.xml


<web-app>
<servlet>
<servlet-name>s11</servlet-name>
<servlet-class>RequestHeaders</servlet-class>
</servlet>
<!-- Servlet Mapping -->
<servlet-mapping>
<servlet-name>s11</servlet-name>
<url-pattern>/requestheaders</url-pattern>
</servlet-mapping>
</web-app>

10.Write a Servlet to display “Hello World” on browser.

0 comments
WTAD Practical - 10
Write a Servlet to display “Hello World” on browser.
WEB-INF/web.xml


<web-app>
<servlet>
<servlet-name>s10</servlet-name>
<servlet-class>Hello</servlet-class>
</servlet>
<!-- Servlet Mapping -->
<servlet-mapping>
<servlet-name>s10</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
</web-app>

Monday, 17 June 2013

9. Write a JavaScript to show a pop up window with a message Hello and background color lime and with solid black border.

0 comments
WTAD Practical - 9
Write a JavaScript to show a pop up window with a message Hello and background
color lime and with solid black border.




<HTML>
<html>
<HEAD>
<TITLE>WTAD.practical-9 @iAmLearningHere </TITLE>
</HEAD>
<body bgcolor="YellowGreen">
    <form name="f1">
            <input type="button" value="Pop Up"    onclick="window.open('w1.html','PopUpWindow','width=2s00',
            'height=50')">
    </form>
</body>
</HTML>

8. Write a JavaScript to find a string from the given text. If the match is found then replace it with another string.

0 comments
WTAD Practical - 8
Write a JavaScript to find a string from the given text. If the match is found then
replace it with another string.




<HTML>
<html>
<HEAD>
<TITLE>WTAD.practical-8 @iAmLearningHere </TITLE>
</HEAD>
<body bgcolor="YellowGreen">
        <font size="4">
        <script language="javascript" type="text/javascript">
        var c = prompt("Enter Text :");
        var searchtxt = prompt("Enter Search Text :");
        document.write("<br>Text is :: " + c );
        document.write("<br>Search text is :: " + searchtxt);
        var r = new RegExp(searchtxt);
        if ( c.search() == -1)
        {
            alert("Match Not Found");
            var searchtxt = prompt("Enter Search Text Again:");
        }
        else
        {
            alert("Match Found !");
            var rtext = prompt("Enter  Text To replace With:");
            document.write("<br>Replace text is :: " + rtext);
            document.write("<br>Replaced Text :: " + c.replace(r,rtext));
        }
    </script>
    </body>
</HTML>

7. Write a JavaScript to convert Celsius to Fahrenheit.

0 comments
WTAD Practical - 7
Write a JavaScript to generate two random numbers and find out maximum and
minimum out of it.




<HTML>
<html>
<HEAD>
<TITLE>WTAD.practical-7 @iAmLearningHere </TITLE>
</HEAD>
<body bgcolor="YellowGreen">
        <center><font size=5>
        <script language="JavaScript">
            var a,b;
            a=parseFloat(prompt("enter the Celsius:",""));
            document.write("Celsius value is: "+a+"<br><br>");
            b=32+(a*1.8);
            alert("Celsius to Fehrenheit "+b);
            document.write("Fehrenheit value is: "+b);
        </script>
    </body>
</HTML>

Monday, 15 April 2013

5. Write a JavaScript to generate two random numbers and find out maximum and minimum out of it.

0 comments
WTAD Practical - 5
Write a JavaScript to generate two random numbers and find out maximum and
minimum out of it.




<HTML>
<HEAD>
<TITLE>WTAD.practical-5 @iAmLearningHere </TITLE>
</HEAD>

<script type="text/javascript">
    function calculateRandom()
    {
        var r1=Math.floor(Math.random()*100);
        var r2=Math.floor(Math.random()*100);
        document.write('<br>Random No.1 : ' + r1);
        document.write('<br>Random No.2 : ' + r2);
        if (r1 < r2)
        {
            document.write('<br><br>Minimum No.:' + r1);
            document.write('<br>Maximum No.:' + r2);
        }
        else
        {
            document.write('<br><br>Minimum No.:' + r2);
            document.write('<br>Maximum No.:' + r1);
        }
    }
</script>

Sunday, 14 April 2013

4. Write a JavaScript that finds out multiples of 10 in 0 to 10000. On the click of button start the timer and stop the counter after 10 seconds. Display on the screen how many multiples of 10 are found out within stipulated time.

0 comments
WTAD Practical-4
Write a JavaScript that finds out multiples of 10 in 0 to 10000. On the click of button
start the timer and stop the counter after 10 seconds. Display on the screen how
many multiples of 10 are found out within stipulated time.



<HTML>
<HEAD>
<TITLE>WTAD.practical-4 @iAmLearningHere </TITLE>
</HEAD>

<script type="text/javascript">
    function start()
    {
        setTimeout("displayMultiple()", 10000); // time in millisecond
    }

    function displayMultiple()  
    {
        var i = 1;
        document.write(" [ ");
        for(i=1; i<=10000; i++)
        {
            if(i%10==0 )
                document.write(i + ' , ');
        }
        document.write(" ] ");
    }
</script>

Saturday, 13 April 2013

3. Create a Form in HTML with two fields, minimum and maximum, write JavaScript to validate that only numeric value is entered in both, and the value entered in minimum is less than the value entered in maximum.

0 comments
WTAD Practicals :

Create a Form in HTML with two fields, minimum and maximum, write JavaScript
to validate that only numeric value is entered in both, and the value entered in
minimum is less than the value entered in maximum.

<HTML>
<HEAD>
<TITLE>WTAD.practical-3 @iAmLearningHere </TITLE>
</HEAD>
<BODY>
<script type="text/javascript">
    function isValidNum(num)
    {
        if(isNaN(num.value))
            alert("plz enter valid number!!");
        num.focus();
    }
  
    function check()
    {
        var num1 = document.getElementsByName("txtmin")[0].value;
        var num2 = document.getElementsByName("txtmax")[0].value;
        if( num1 < num2 )
            document.getElementById("msg").innerHTML=" Minimum is less than Maximum. OK!";
        else
            document.getElementById("msg").innerHTML="Wrong Entry!!";       
    }
</script>

Friday, 12 April 2013

2. Write a JavaScript that demonstrates the use of +=,-=,*=,/= operators.

0 comments
WTAD Practical-2
Write a JavaScript that demonstrates the use of +=,-=,*=,/= operators.


<HTML>
<HEAD>
<TITLE>WTAD.practical-2 @iAmLearningHere </TITLE>
</HEAD>
<BODY>
<H2>Demonstration the use of +=,-=,*=,/= operators.</H2>
<H3>
<script type="text/javascript">

    var i = 11;
    document.write("<br> i = " + i);
    i += 10;
    document.write("<br>( i +=10 ) =>" + i);
    i *= 10;
    document.write("<br>( i *=10 ) =>" + i);
    i -= 10;
    document.write("<br>( i -=10 ) =>" + i);
    i /= 10;
    document.write("<br>( i /=10 ) =>" + i);
</script>

Thursday, 11 April 2013

1. Write a JavaScript that shows how a variable’s type can be changed on-the-fly.

0 comments
WTAD Practical -1 :
Write a JavaScript that shows how a variable’s type can be changed on-the-fly.


<HTML>
<HEAD>
<TITLE>WTAD.practical-1 @iAmLearningHere </TITLE>
</HEAD>
<BODY>

<H4>See the Variable Type is changing .. !!</H4>
<script type="text/javascript">
    var p1 = 11;
    document.write("<br>p1 contains ::"+ p1 +" of Type :: "+ typeof(p1) +"<br>");
    p1 = 11.1;
    document.write("<br>p1 contains ::"+ p1 +" of Type :: "+ typeof(p1)+"<br>");
    p1 = 'i';
    document.write("<br>p1 contains ::"+ p1 +" of Type :: "+typeof(p1)+"<br>");
    p1 = true;
    document.write("<br>p1 contains ::"+ p1 +" of Type :: "+typeof(p1)+"<br>");
    p1 = "iamlearninghere";
    document.write("<br>p1 contains ::"+ p1 +" of Type :: "+typeof(p1)+"<br>");

</script>

Thursday, 29 March 2012

Queue Implementation using Array

0 comments

Write a program to perform the following operation on a simple queue ( using Array )
    a.    Insert an element
    b.    Remove an element
    c.    Display
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>

class Queue
{
    int *que, F, R;
    int size;
public :
    Queue(int s)
    {
        F = R = -1;
        size = s;
        que = new int[size];
    }
    void insertElement(int); // insert element fucntion
    void display();
    void delElement();
};

void Queue :: insertElement(int element)
{
    if(R == (size - 1))
        cout<<endl<<"Queue is Full"<<endl;
    else
    {
        if(F == -1 )
            F = 0;
        R++;
        que[R] = element;
    }
}

void Queue :: delElement()
{
    if(F  == -1)
        cout<<endl<<"Queue is Empty";
    else
    {
        if(F == R)
        {
            F = R = -1;
        }
        else
        {
            int element = que[F];
            F++;
            cout<<endl<<"Deleted Element is : "<<element<<endl;
        }
    }
}
void Queue :: display()
{
    cout<<endl<<"\t\t\t";

    for(int i = F; i <= R; i++)
    {
        cout<<que[i]<<"  ";
    }
    cout<<endl;
}


void main()
{

    int ch, element, size;

    clrscr();
    cout<<endl<<"Queue OPERATION";

    cout<<endl<<"Enter Size for Queue: ";
    cin>>size;

    Queue q(size);        //object of queue class

    while(1)
    {

    cout<<endl<<" 1. Insert";
    cout<<endl<<" 2. delete";
    cout<<endl<<" 3. Exit"<<endl;
    cin>>ch;

    switch(ch)
    {
        case 1:
            cout<<endl<<"Enter Element: ";
            cin>>element;

            q.insertElement(element);

            q.display();
            break;
        case 2: q.delElement();
            q.display();
            break;
        case 3:
            exit(0);
        default:
            cout<<endl<<"wrong choice"<<endl;
    }

    }

getch();
}

Sunday, 18 March 2012

Stack implementaion using Array in CPP

1 comments

Definition : Stack is linear Data Structure, it is a collection of homogeneous data elements where insertion and deletion operation take place at one end only(TOP).

Operation on stack:
  • PUSH   :   insertion into stack
  • POP      :   deletion in stack
  • PEEP    :   display the last ( TOP )  element
Write a program to perform the following operations on a stack using Array (CPP).
    a.    PUSH   
    b.    POP
    c.    ISEMPTY
    d.    ISFULL
    e.    PEEP

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
#define N 5

class Stack
{
    int sArr[N];     //stack array
    int top;
public:
    Stack()      //constructor to initialize top
    {
        top=-1;
    }

    void push(int);
    void pop();
    int isEmpty();
    int isFull();
    void peep();
    void display();
};
void Stack :: push(int element)
{
    if(isFull())
    {
        cout<<"\n Stack OverFlow";
    }
    else
    {
        top++;
        sArr[top]=element;
    }
}
void Stack :: pop()
{
    if(isEmpty())
    {
        cout<<"\n Stack UnderFlow";
    }
    else
    {
        cout<<endl<<"Deleted Element is: "<<sArr[top];
        sArr[top]=NULL;
        top--;
    }
}

int Stack :: isEmpty()
{
    if(top<0)
        return 1;
    else
        return 0;
}
int Stack :: isFull()
{
    if(top == N-1)
        return 1;
    else
        return 0;
}

void Stack :: peep()
{
    if(isEmpty())
        cout<<"\n Stack is EMPTY";
    else
        cout<<"\nTOP ELEMENT IS:  "<<sArr[top];
}
void Stack :: display()
{
    cout<<endl<<"\t\t\t";
    for(int i=top ; i >= 0 ; i--)
    {
        cout<<sArr[i]<<endl<<endl<<"\t\t\t";
    }
}


void main()
{
    Stack s;  //object creation
    int ch, data;
    clrscr();
    cout<<"\n\n STACK OPERATIONS";

    while(1)
    {

    cout<<"\n\n1. PUSH";
    cout<<"\n2. POP";
    cout<<"\n3. PEEP";
    cout<<"\n4. EXIT";
    cout<<"\nEnter Choice: ";
    cin>>ch;
    clrscr();
        cout<<"\n\n STACK OPERATIONS\n\n";

        switch(ch)
        {
        case 1:
            cout<<"\n Enter Value: ";
            cin>>data;

            s.push(data);
            s.display();
            break;
        case 2: s.pop();
            s.display();
            break;
        case 3: s.peep();
            break;
        case 4: exit(0);
            break;
        }
    }
getch();
}
 

Recent Post

Recent Comments

© 2010 IamLearningHere Template by MBT