Search This Blog

Sunday 24 August 2014

21. JSP Program to Sort Two Dimensional Array.

<!-- 21. JSP Program to sort 2D array. -->
<html>
<head>
</head>

<body bgcolor="beige">
<h2>TWO - DIMENSIONAL ARRAY SORTING</h2>
<h2><font color="blue">
<%
    int A[][]={ {12,5,14},{3,2,66},{28,45,4},{23,6,16}};
    int  t=0;
    int row=A.length;
    int col=A[0].length;
   
    out.println("The Given 2D Array:<BR>");

%>
   
    <table border=3 height=200 width=200>
<%
    for(int i=0;i<row;i++)
    {
%>
         
        <tr align=center >
<%
        for(int j=0;j<col;j++)
        {
%>
            <td><%=A[i][j]%></td>
<%
        }
%>
        </tr>
<%
    }
%>
    </table>
<%  

      
            for(int x=0;x<row;x++)
            {
                for(int y=0;y<col;y++)
                {
                    for(int i=0;i<row;i++)
                    {
                        for(int j=0;j<col;j++)
                        {
                            if(A[i][j]>A[x][y])
                            {
                                t=A[x][y];
                                A[x][y]=A[i][j];
                                A[i][j]=t;
                            }
                        }
                    }
                }
            }

        out.println("The Sorted 2D Array:<BR>");
%>
        <table border=3 height=200 width=200>
<%
    for(int i=0;i<row;i++)
    {
%>
         
        <tr align=center >
<%
        for(int j=0;j<col;j++)
        {
%>
            <td><%=A[i][j]%></td>
<%
        }
%>
        </tr>
<%
    }
%>
    </table>
  
    </font></h2>
    <body>
</html>

20. HTML and JSP Program to Evaluate Salary Details of an Employee and Display using TABLE tag.

Filename:Employee20.html
<!-- 20. Program to accept Employee Details. -->
<html>
 <head>

 <title>Employee Salary Statement</title>
 </head>
 <body>
 <h3>Enter Employee Details:<h3>
 <form action="emp20.jsp" method="POST" >
 <table >
 <tr><td>Employee Name:</td><td><input type="text" name="ename" autofocus></td></tr>
 <tr><td>Department:</td><td><input type="text" name="dept"></td></tr>
 <tr><td>Designation:</td><td><input type="text" name="des"></td></tr>
 <tr><td>Basic Salary:</td><td><input type="text" name="bsal"></td></tr>
 <tr><td>TA(%):</td><td><input type="text" name="ta"></td></tr>
 <tr><td>DA(%):</td><td><input type="text" name="da"></td></tr>
 <tr><td>HRA(%):</td><td><input type="text" name="hra"></td></tr>
 <tr><td>PF(%):</td><td><input type="text" name="pf"></td></tr>
 <tr><td>LIC(%):</td><td><input type="text" name="lic"></td></tr>

 <tr><td><input type="submit" value="Evaluate"></td>
 <td><input type="reset" value="Reset"></td></tr>
 </table>
 
 </body>
</html>


Filename:Employee20.jsp
<!-- 20. JSP Program to Evaluate Salary Details of an Employee and display using TABLE tag. -->
<html>
<head>
<%@ page import="java.sql.*" %>
</head>
<body bgcolor="beige">

<%
   
    String ename=request.getParameter("ename");
    String dept=request.getParameter("dept");
    String des=request.getParameter("des");
    double bsal=Double.valueOf(request.getParameter("bsal"));
    double ta=Double.valueOf(request.getParameter("ta"));
    double ta2=bsal*ta/100;
    double da=Double.valueOf(request.getParameter("da"));
    double da2=bsal*da/100;
    double hra=Double.valueOf(request.getParameter("hra"));
    double hra2=bsal*hra/100;
    double pf=Double.valueOf(request.getParameter("pf"));
    double pf2=bsal*pf/100;
    double lic=Double.valueOf(request.getParameter("lic"));
    double lic2=bsal*lic/100;
    double allowance;
    double deduction;
    double gsal;
    double netsal;

    allowance = (bsal*ta)/100 + (bsal*da)/100 + (bsal*hra)/100;
    deduction = (bsal*pf)/100 + (bsal*lic)/100;
    gsal = bsal + allowance;
    netsal = gsal - deduction;
   


%>
    <CENTER>
    <table border=5 bgcolor="biege" height=600 width=400 >
    <caption><h2><font color="blue" >XYZ Company Ltd.,<br>SALARY STATEMENT</font></h2></caption>
    <tr><td>Employee Name</td><td colspan=2><%=ename%></td></tr>
    <tr><td>Department</td><td colspan=2><%=dept%></td></tr>
    <tr><td>Designation</td><td colspan=2><%=des%></td></tr>
    <tr><td>Basic Salary</td><td colspan=2><%=bsal%></td></tr>
    <tr><th>Allowances</th><th>Percentage</th><th>Amount</th></tr>
    <tr align=center><td>TA</td><td><%=ta%></td><td><%=ta2%></td></tr>
    <tr align=center><td>DA</td><td><%=da%></td><td><%=da2%></td></tr>
    <tr align=center><td>HRA</td><td><%=hra%></td><td><%=hra2%></td></tr>
    <tr><th>Total Allowance:</th><td colspan=2><%=allowance%></td><tr>
    <tr><th>Deductions</th><th>Percentage</th><th>Amount</th></tr>
    <tr align=center><td>PF</td><td><%=pf%></td><td><%=pf2%></td></tr>

    <tr align=center><td>LIC</td><td><%=lic%></td><td><%=lic2%></td></tr>
    <tr><th>Total Deduction:</th><td colspan=2><%=deduction%></td><tr>
    <tr><td>Gross Salary</td><td colspan=2><%=gsal%></td></tr>
   
    <tr><td>Net Salary</td><td colspan=2><%=netsal%></td></tr>
    </table>
    </CENTER>

</body>
</html>

 

19. HTML and JSP Program to Evaluate the Result of a Student and Display using TABLE Tag.


Filename:Student19.html
<!-- 19. Program to read student information -->
<html>
 <head>

 <title>Student Information</title>
 </head>
 <body>
 <h3>Enter Student Details:</h3>
 <form action="Student19.jsp" method="POST" >
 <table >
 <tr><td>Name:</td><td><input type="text" name="sname" autofocus></td></tr>
 <tr><td>Register Number:</td><td><input type="text" name="regno"></td></tr>
 <tr><td>Sub1:</td><td><input type="text" name="sub1"></td></tr>
 <tr><td>Sub2:</td><td><input type="text" name="sub2"></td></tr>
 <tr><td>Sub3:</td><td><input type="text" name="sub3"></td></tr>
 <tr><td>Sub4:</td><td><input type="text" name="sub4"></td></tr>
 <tr><td>Sub5:</td><td><input type="text" name="sub5"></td></tr>

 <tr><td><input type="submit" value="Submit"></td><td><input type="reset" value="Reset"></td></tr>
 </table>

 </form> 
</body>
</html>


Filename:Student19.jsp
<!-- 19. JSP Program to evaluate the result of a student and display using TABLE tag. -->   
<html>
<head>
<%@ page import="java.io.*,java.util.*" %>
</head>
<body>
<%
    String sname=request.getParameter("sname");
    String regno=request.getParameter("regno");
    int m1=Integer.parseInt(request.getParameter("sub1"));
    int m2=Integer.parseInt(request.getParameter("sub2"));
    int m3=Integer.parseInt(request.getParameter("sub3"));
    int m4=Integer.parseInt(request.getParameter("sub4"));
    int m5=Integer.parseInt(request.getParameter("sub5"));
    int total_marks;
    float percent;
    String grade="";

   
    total_marks=m1+m2+m3+m4+m5;
    percent = (float)(total_marks*100) / 500;
   
    if(m1<40 || m2<40 || m3<40 || m4<40 || m5<40)
        grade= "FAIL";
    else
    {
        if(percent >=70)
            grade = "DISTINCTION";
        else if(percent >= 60 && percent < 70)
            grade = "FIRST CLASS";
        else if(percent >= 50 && percent < 60)
            grade = "SECOND CLASS";
        else if(percent >= 40 && percent < 50)
            grade = "PASS";
       
    }

%>
    <CENTER>
    <table border=5 bgcolor="pink" height=800 width=600 >
    <h2>College Name</h2>
    <caption><h2><font color="blue" >Marks List</font></h2></caption>
   
    <tr><td><b>NAME</b></td><td colspan=3><%=sname%></td></tr>
    <tr><td><b>REGISTER NUMBER</b></td><td colspan=3><%=regno%></td></tr>
    <tr><th>SUBJECTS</th><th>MAX. MARKS</th><th>MIN. MARKS</th><th>MARKS OBTAINED</th></tr>
    <tr align=center><td>SUBJECT1</td><td>100</td><td>40</td><td><%=m1%></td></tr>
    <tr align=center><td>SUBJECT2</td><td>100</td><td>40</td><td><%=m2%></td></tr>
    <tr align=center><td>SUBJECT3</td><td>100</td><td>40</td><td><%=m3%></td></tr>
    <tr align=center><td>SUBJECT4</td><td>100</td><td>40</td><td><%=m4%></td></tr>
    <tr align=center><td>SUBJECT5</td><td>100</td><td>40</td><td><%=m5%></td></tr>
    <tr><td><b>TOTAL</b></td><td colspan=3><%=total_marks%></td></tr>

    <tr><td><b>PERCENT</b></td><td colspan=3><%=percent%>%</td></tr>
    <tr><td><b>GRADE</b></td><td colspan=3><%=grade%></td></tr>
    </table>
    </CENTER>
       
</body>
</html>
 



Saturday 23 August 2014

18. HTML and JSP Program to Evaluate the Result of a Student.

Filename: Student18.html
<!-- 18. Program to read student information -->
<html>
 <head>

 <title>Student Information</title>
 </head>
 <body>
 <h3>Enter Student Details:<h3>
 <form action="Student18.jsp" method="POST" >
 <table >
 <tr><td>Name:</td><td><input type="text" name="sname" autofocus></td></tr>
 <tr><td>Register Number:</td><td><input type="text" name="regno"></td></tr>
 <tr><td>Sub1:</td><td><input type="text" name="sub1"></td></tr>
 <tr><td>Sub2:</td><td><input type="text" name="sub2"></td></tr>
 <tr><td>Sub3:</td><td><input type="text" name="sub3"></td></tr>
 <tr><td>Sub4:</td><td><input type="text" name="sub4"></td></tr>
 <tr><td>Sub5:</td><td><input type="text" name="sub5"></td></tr>

 <tr><td><input type="submit" value="Submit"></td><td><input type="reset" value="Reset"></td></tr>
 </table>
 </body>
</html>



Filename: Student18.jsp
 <!-- 18. JSP Program to evaluate the result of a student. -->  
<html>
<head>
<%@ page import="java.io.*,java.util.*" %>
</head>
<body>
<%
    String sname=request.getParameter("sname");
    String regno=request.getParameter("regno");
    int m1=Integer.parseInt(request.getParameter("sub1"));
    int m2=Integer.parseInt(request.getParameter("sub2"));
    int m3=Integer.parseInt(request.getParameter("sub3"));
    int m4=Integer.parseInt(request.getParameter("sub4"));
    int m5=Integer.parseInt(request.getParameter("sub5"));
    int total_marks;
    float percent;
    String grade="";

  
    total_marks=m1+m2+m3+m4+m5;
    percent = (float)(total_marks*100) / 500;
  
    if(m1<40 || m2<40 || m3<40 || m4<40 || m5<40)
        grade= "FAIL";
    else
    {
        if(percent >=70)
            grade = "DISTINCTION";
        else if(percent >= 60 && percent < 70)
            grade = "FIRST CLASS";
        else if(percent >= 50 && percent < 60)
            grade = "SECOND CLASS";
        else if(percent >= 40 && percent < 50)
            grade = "PASS";
      
    }

%>

        <h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kuvempu University</h3>
        <h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MARKS SHEET</h3>
      
        <b>Name of the Student:&nbsp;<%=sname%>
        <br>
        Register Number &nbsp;:&nbsp;<%=regno%></b>
        <br>
        ================================================================================
        <br>
        SUBJECTS  &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;MAX.MARKS &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;    MIN.MARKS  &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;    MARKS OBTAINED
        <br>
        ================================================================================<br>
        1.&nbsp;K/U/H/S &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;40&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;  &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<%=m1%>
        <br>
        2.&nbsp;ENGLISH &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=m2%>
        <br>
        3.&nbsp;JAVA PROGRAMMING &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<%=m3%><br>
        4.&nbsp;OPERATIONS RESEARCH &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<%=m4%><br>
        5.&nbsp;COMPUTER GRAPHICS &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=m5%><br>
        ================================================================================<br>
        <b>TOTAL MARKS &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=total_marks%></b><br>
        ================================================================================<br>
        <b>PERCENTAGE MARKS :&nbsp;<%=percent%>%</b><br>
        <b>GRADE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;:&nbsp;<%=grade%></b><br>
        ================================================================================<br>
</body>
</html>

17. JSP Program to Evaluate the Result of a Student and Display using TABLE tag.

<!-- 17. JSP Program to Evaluate the Result of a Student and Display using <TABLE> tag. -->   
<html>
<body>
<%!
    //Initialize all the values in the beginning.
    String stud_name="ARJUN";
    String course="BCA";
    String sem="V Sem";
    String reg_no="BC112033";
    int m1=95;
    int m2=95;
    int m3=96;
    int m4=95;
    int m5=65;
    int total_marks;
    float percent;
    String grade;
%>
<%
    //evaluate grade in this section.
    total_marks=m1+m2+m3+m4+m5;
    percent = (float)(total_marks*100) / 500;
   
    if(m1<40 || m2<40 || m3<40 || m4<40 || m5<40)
        grade= "FAIL";
    else
    {
        if(percent >=70)
            grade = "DISTINCTION";
        else if(percent >= 60 && percent < 70)
            grade = "FIRST CLASS";
        else if(percent >= 50 && percent < 60)
            grade = "SECOND CLASS";
        else if(percent >= 40 && percent < 50)
            grade = "PASS";
       
    }
    out.println("<br>");
%>

    <CENTER>
    <CAPTION><H2>MARKS LIST</H2></CAPTION>
    <TABLE BORDER=5 BGCOLOR="ORANGE" HEIGHT=500 WIDTH=300>
    <TR><TD>NAME</TD><TD><%=stud_name%></TD></TR>
    <TR><TD>REGISTER NUMBER</TD><TD><%=reg_no%></TD></TR>
    <TR><TD>SUBJECT1</TD><TD><%=m1%></TD></TR>
    <TR><TD>SUBJECT2</TD><TD><%=m2%></TD></TR>
    <TR><TD>SUBJECT3</TD><TD><%=m3%></TD></TR>
    <TR><TD>SUBJECT4</TD><TD><%=m4%></TD></TR>
    <TR><TD>SUBJECT5</TD><TD><%=m5%></TD></TR>
    <TR><TD>TOTAL MARKS</TD><TD><%=total_marks%></TD></TR>
    <TR><TD>PERCENT</TD><TD><%=percent%></TD></TR>
    <TR><TD>GRADE</TD><TD><%=grade%></TD></TR>
    </TABLE>
    </CENTER>



</body>
</html>

08_2 Simplified JSP Program to Evaluate the Result of a Student.

Filename:Result.jsp
<!-- 08. Simplified JSP Program to Evaluate the Result of a Student. -->   
<html>
<body>
<%!
    //Initialize all the values in the beginning.
    String stud_name="MANOHAR";
    String course="BCA";
    String sem="V Sem";
    String reg_no="BC112033";
    int m1=95;
    int m2=95;
    int m3=96;
    int m4=95;
    int m5=65;
    int max_marks=500;
    int total_marks;
    float percent;
    String grade;
%>
<%
    //evaluate grade in this section.
    total_marks=m1+m2+m3+m4+m5;
    percent = (float)(total_marks*100) / 500;
   
    if(m1<40 || m2<40 || m3<40 || m4<40 || m5<40)
        grade= "FAIL";
    else
    {
        if(percent >=70)
            grade = "DISTINCTION";
        else if(percent >= 60 && percent < 70)
            grade = "FIRST CLASS";
        else if(percent >= 50 && percent < 60)
            grade = "SECOND CLASS";
        else if(percent >= 40 && percent < 50)
            grade = "PASS";
       
    }
    out.println("<br>");
%>

        <h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;KUVEMPU UNIVERSITY</h3>
        <h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MARKS SHEET</h3>
        <br>
        <b>NAME OF THE STUDENT :&nbsp;<%=stud_name%>
        <br>
        REGISTER NUMBER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<%=reg_no%>
        </b>
        <br>
       
        ================================================
        <br>
        SUBJECTS  &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;MARKS OBTAINED
        <br>
        ================================================<br>
        1.&nbsp;K/U/H/S &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=m1%>
        <br>
        2.&nbsp;ENGLISH &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=m2%>
        <br>
        3.&nbsp;JAVA PROGRAMMING &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=m3%>
        <BR>
        4.&nbsp;OPERATIONS RESEARCH &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=m4%>
        <br>
        5.&nbsp;COMPUTER GRAPHICS &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=m5%>
        <br>
        ================================================<br>
        <b>TOTAL MARKS &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=total_marks%>
        </b><br>
        ================================================<br>
        <b>PERCENTAGE MARKS :&nbsp;<%=percent%>%</b><br>
        <b>GRADE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;:&nbsp;<%=grade%></b><br>
        ================================================<br>
</body>
</html>

Thursday 21 August 2014

5. HTML and JSP Program to Sort Names and Search for a Key using Recursive Binary Search.

Filename:Bin5.html
<!-- 5. HTML program to sort and search using recursive binary search. -->
<HTML>
    <HEAD>
        <TITLE>Sorting and Recursive Binary Searching</TITLE>
    </HEAD>

    <BODY>
        <H1>Program to search for key</H1>
        <FORM ACTION="Bin5.jsp" METHOD="POST">
              Please enter the search key:
            <BR>
           
              <input type="text" NAME="text1" >
            <BR>
            <INPUT TYPE="SUBMIT"  VALUE="Submit">
        </FORM>
    </BODY>
<HTML>


Filename:Bin5.jsp
<!-- 5. JSP Pro search for a key using recursive binary searchgram to sort strings and -->
<html>
  <body>
     <%
       final  String a[]={"Pineapple" , "Orange" , "Apple",

       "Grapes", "Banana","Mango"};
       String  temp;
       int flag=0,j,index;
       out.println("The sorted list of names:");
       for(j=0; j<a.length;j++)
       {
          for (int i=j+1 ; i<a.length; i++)
          {
             if(a[i].compareToIgnoreCase(a[j]) < 0)
             {
                temp= a[j];
                a[j]= a[i];
                a[i]=temp;
             }
          }
        %>
        <br>
        <%
        out.print(a[j]);
    }
 %>
 <br>
 <br>
   <%
    String key=request.getParameter("text1");
    index = binsearch(key,a,0,a.length);
    if(index > -1)
        out.println("Search Key Found at location "+(index+1));
    else
        out.println("Search Key Not Found!");
   %>
   <%!
       public static int binsearch(String key, String[] a, int low, int high)
       {
            if (high <= low)
                return -1;
            int mid = low + (high - low) / 2;
            int cmp = a[mid].compareToIgnoreCase(key);
            if (cmp > 0)
                  return binsearch(key, a, low, mid);
            else if(cmp < 0)
                return binsearch(key, a, mid+1, high);
            else 
                 return mid;
        }
   %>
  <body>
</html>

Sunday 17 August 2014

10. HTML and JSP Program Handle the Functionalities of a Shop.

Filename: Shop.html
<!-- 10. HTML program to design an interface for a shop. -->
<html>
 <head>

  <title>Shop Details</title>
 </head>
 <body>
 <h3>Program to handle the functionalities of a shop.</h3>
 <h4>Fill all the following fields.<h4>
 <form name="form1" action="Shop.jsp" method="POST">
   
    <b>Item Number&nbsp;:<input type="text" name="text1"><br><br>
    Item Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:<input type="text" name="text2"><br><br>
    Item Type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:<select name="select1" >
                    <option value="Books">Books</option>
                    <option value="Handbags">Handbags</option>
                    <option value="Software">Software</option>

                 </select> <br><br>
    Unit Price&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:<input type="text" name="text3"><br><br>
    Quantity&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:<input type="text" name="text4"><br><br>
    <input type="Submit" value="Calculate" style="height:30px; width:80px">
    <input type="Reset" value="Reset" style="height:30px; width:80px">
    </b>
 </form>

 </body>
</html>


Filename:  Shop.jsp
<!-- 10. JSP program handle the functionalities of a shop. -->
<html>
<body>

<h3>Program to handle the functionalities of a shop.</h3>
<h3>Details of Transaction:</h3>
<%
    String Item_Number=request.getParameter("text1");
    String Item_Name=request.getParameter("text2");
    String Item_Type=request.getParameter("select1");
    float Unit_Price=Float.parseFloat(request.getParameter("text3"));
    int qty=Integer.parseInt(request.getParameter("text4"));
    double Discount;
    double Price;
    double Amount;
    Price= Unit_Price * qty;
    //out.println("*"+Item_type+"*");

%>
<%
    if(Item_Type.compareTo("Books")==0)
    {
        out.println("10% Discount on Books");
        Discount=Price * 0.1;
    }
    else if(Item_Type.compareTo("Handbags")==0)
    {
        out.println("20% Discount on Handbag");
        Discount=Price * 0.2;
    }
    else if(Item_Type.compareTo("Software")==0)
    {
        out.println("15% Discount on Softwares");
        Discount=Price * 0.15;
    }
    else
    {
        out.println("Select any value");
        Discount=0;
    }
    Amount = Price - Discount;
%>

      
    <table border=3 cellpadding=10 cellspacing=5 bordercolor="blue">
    <b>
    <tr><td>Item Number</td><td><%=Item_Number%></td></tr>
    <tr><td>Item Name</td><td><%=Item_Name%></td></tr>
    <tr><td>Item Type</td><td><%=Item_Type%></td></tr>
    <tr><td>Unit Price</td><td><%=Unit_Price%></td></tr>
    <tr><td>Quantity</td><td><%=qty%></td></tr>
    <tr><td>Price</td><td><%=Price%></td></tr>
    <tr><td>Discount</td><td><%=Discount%></td></tr>
    <tr><td>Amount</td><td><%=Amount%></td></tr>
    </b>
    </table>

</body>
</html>

09. JSP Program to Evaluate Salary Details of an Employee.

<!-- 09.JSP program to evaluate salary details of an employee. -->
<html>
<body bgcolor="beige">
<%
    String ename="Dinesh";
    String des="Manager";
    double bsal=20000;
    double ta=10;
    double da=30;
    double hra=10;
    double pf=10;
    double lic=15;
    double allowance;
    double deduction;
    double gsal;
    double netsal;

    allowance = (bsal*ta)/100 + (bsal*da)/100 + (bsal*hra)/100;
    deduction = (bsal*pf)/100 + (bsal*lic)/100;
    gsal = bsal + allowance;
    netsal = gsal - deduction;

%>
    <center>
    <h2> JSP Program to Evaluate Salary Details of an Employee</h2>
  
    <table border=2 cellpadding=5 bordercolor="Blue" bgcolor=orange height=400 width=200>
    <caption><h2>Employee Details</h2></caption>
    <tr><td bgcolor="red">Name</td> <td><%=ename%></td></tr>
    <tr><td>Designation</td> <td><%=des%></td></tr>
    <tr><td>Basic Salary</td> <td><%=bsal%></td></tr>
    <tr><td>Allowance</td> <td><%=allowance%></td></tr>
    <tr><td>Deduction</td> <td><%=deduction%></td></tr>
    <tr><td>Gross Salary</td> <td><%=gsal%></td></tr>
    <tr><td>Net Salary</td> <td><%=netsal%></td></tr>

    </table>
    </center>

</body>
</html>

Monday 11 August 2014

02. Corrected Program to Sort List of Names and Search for a Key by Ignoring Case.

Filename: Sort.html
//Html program to read search key
<HTML>
    <HEAD>
        <TITLE>Sorting and Searching</TITLE>
    </HEAD>

    <BODY>
        <H1>Program to sort list of names and search for key</H1>
        <FORM ACTION="Sort.jsp" METHOD="POST">
              Please enter your the search key:
            <BR>
           
              <input NAME="text1" type="text">
            <BR>
            <INPUT TYPE="SUBMIT"   VALUE="Submit">
        </FORM>
    </BODY>
<HTML>


Filename: Sort.jsp
<html>
<body>
<%@ page import="java.io.*,java.util.*" %>
<%
    String str[]={"Pineapple","Orange","Grapes","Banana","Apple"};
    String  temp;
    int flag=0,j;
    out.println("<H2>The sorted list of names:</H2>");
    for(j=0; j<str.length;j++)
    {
         for (int i=j+1 ; i<str.length; i++)
        {
             if(str[i].compareToIgnoreCase(str[j])<0)
            {
                temp= str[j];
                str[j]= str[i];
                str[i]=temp;
            }
        }
        out.print(str[j]+"<br>");
    }
 %>
 <br>
 <br>
 <%

    String key=request.getParameter("text1");
    for(j=0; j<str.length;j++)
    {
         if(str[j].compareTo(key)==0)
        {
              flag=1;
              break;
        }
    }

    if(flag==1)
        out.println("<h3>Search Key Found at location "+ (j+1) +"<h3>");
    else
        out.println("<h3>Search Key Not Found!</h3>");


%>
<body>
</html>

Friday 8 August 2014

08. JSP Program to Evaluate the Result of a Student.

<!-- 08. JSP Program to evaluate the result of a student. -->  
<html>
<body>
        <%!
        //Initialize all the values in the beginning.
            String stud_name="Rajesh";
            String course="BCA";
            String sem="V Sem";
            String reg_no="BC112033";
            int m1=100;
            int m2=95;
            int m3=96;
            int m4=95;
            int m5=65;
            int max_marks=500;
            int total_marks;
            float percent;
            String grade;
        %>
        <%
                total_marks=m1+m2+m3+m4+m5;
                percent = (float)(total_marks*100) / 500;
  
        if(m1<40 || m2<40 || m3<40 || m4<40 || m5<40)
            grade= "FAIL";
        else
        {
                if(percent >=70)
                    grade = "DISTINCTION";
                else if(percent >= 60 && percent < 70)
                    grade = "FIRST CLASS";
                else if(percent >= 50 && percent < 60)
                    grade = "SECOND CLASS";
                else if(percent >= 40 && percent < 50)
                    grade = "PASS";
          
        }


%>

        <%
      
        out.println("<br>");
        %>

        <h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Kuvempu University</h3>
        <h3>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MARKS SHEET</h3>
      
        <b>Name of the Student:&nbsp;<%=stud_name%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;Register Number &nbsp;:&nbsp;<%=reg_no%></b>
        <br>
        <b>Course&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<%=course%>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        Semester&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<%=sem%></b>
        <br>
        ================================================================================
        <br>
        SUBJECTS  &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;MAX.MARKS &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;    MIN.MARKS  &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;    MARKS OBTAINED
        <br>
        ================================================================================<br>
        1.&nbsp;K/U/H/S &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;40&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;  &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<%=m1%>
        <br>
        2.&nbsp;ENGLISH &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=m2%>
        <br>
        3.&nbsp;JAVA PROGRAMMING &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<%=m3%><br>
        4.&nbsp;OPERATIONS RESEARCH &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;40&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<%=m4%><br>
        5.&nbsp;COMPUTER GRAPHICS &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;100&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;40&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=m5%><br>
        ================================================================================<br>
        <b>TOTAL MARKS &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;500&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;200&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=total_marks%></b><br>
        ================================================================================<br>
        <b>PERCENTAGE MARKS :&nbsp;<%=percent%>%</b><br>
        <b>GRADE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        &nbsp;&nbsp;&nbsp;:&nbsp;<%=grade%></b><br>
        ================================================================================<br>
</body>
</html>

07. JSP Program to Find the Biggest among Three Numbers using HTML Interface.

    Filename: Big3.html
    <!--07. Biggest among Three numbers-->
    <html>
    <head>
    <title>Find the biggest among three numbers</title>
    </head>
    <body bgcolor="orange">
    <center><h1> Find the biggest among three numbers </h1></center>
    <form action="Big3.jsp" method="post">
    <table>
    <tr><td>Enter the First Number :</td><td><input autofocus type="text" name="t1" ></td></tr>
    <tr><td>Enter the Second Number :</td><td><input type="text" name="t2" ></td></tr>
    <tr><td>Enter the Third Number : </td><td><input type="text" name="t3" ></td></tr>
    <tr><td></td><td><input type="submit" value="Find Big" ></td></tr>
    </table>
    </form>
    </body>
    </html>



     Filename: Big3.jsp
    <!--07. JSP program to find the biggest among three numbers.-->
     <%@ page import="java.lang.*" %>
    <html>
    <body bgcolor="orange">
    <%
        int a= Integer.parseInt(request.getParameter("t1"));
        int b= Integer.parseInt(request.getParameter("t2"));
        int c= Integer.parseInt(request.getParameter("t3"));
    %>
    <h1>Biggest Number is:
    <%
        if ((a>b) && (a>c))
            out.println(a);
        else if (b>c)
            out.println(b);
        else
            out.println(c);
    %>
    </h1>
    </body>
    </html>

06. JSP Program to Find Biggest among given N Numbers.

<!--06. JSP Program to find biggest among given N numbers.-->

<HTML>
    <HEAD>
        <TITLE>Biggest Number</TITLE>
        <%@ page import="java.io.*,java.util.*,java.lang.*" %>
    </HEAD>

    <BODY>
        <H1>JSP Program to find biggest of 2,3 and N numbers.</H1>
       
        <BR>
        <%!
            int str[]=new int[20];
        %>
        <%
        int i,a,big=0;
        int num[]={12,45,78,5,744,54,6};
        int len=num.length;
        if(len<=1)
            out.println("Enter atleast 2 numbers to compare.");
        %>
        <BR>
        <font color="Red">Given Numbers are:</font>
        <%
        for(i=0;i<len;i++)
            out.println(num[i]);
        %>
        <BR>
        <%
        out.println("Biggest Number is:");
        if(len==2)
            big=biggest(num[0],num[1]);
        else if(len==3)
            big =biggest(num[0],num[1],num[2]);
        else
            big=biggest(num,len);
        out.println(big);
        %>
       
        <%!
        int biggest(int a, int  b) // for two nos.
        {
            if (a>b)
            {
                return(a); 
            }
            return(b);
        }
   
        int biggest(int a , int b, int c) //for three nos.
        {
            int big1;
            if (a>b && a>c)
            {
                big1 = a;
            }
            else
            {
                if (b>c)
                {
                    big1 = b;
                }
                else
                {
                    big1 = c;
                }
            }
            return(big1);
        }   

        int biggest(int num[], int n) //for n numbers
        {
            int big1;
            big1=num[0];
            for(int i=0;i<n;i++)
            {
                if(num[i]>big1)
                    big1=num[i];
            }
            return big1;
        }
    %>
    </BODY>
</HTML>

Sunday 3 August 2014

04. Program to Search a Given Name using Linear Search.

//Filename : LinSearch.html
<!--04_Html program to read search key-->
<HTML>
    <HEAD>
        <TITLE>Linear Search</TITLE>
    </HEAD>

    <BODY>
        <H1>Program to search name using Linear Search.</H1>
        <FORM ACTION="LinSearch.jsp" METHOD="POST">
              Please enter your the search key:
            <BR>
           
              <input NAME="text1" type="text">
            <BR>
            <INPUT TYPE="SUBMIT"   VALUE="Submit">
        </FORM>
    </BODY>
<HTML>


//Filename:LinSearch.jsp
<!--04. Program to search a given name using linear search.-->
<html>
<body>
<%
    final  String str[]={"Pineapple" , "Orange" , "Apple", "Grapes",

    "Banana"};
    String  temp;
    int flag=0,j;
    %>
    <h2>The list of names:</h2>
   
   
    <%
   

    for(j=0; j<str.length;j++)
    {
         out.println(str[j]+"<br>");
    }

 %>
 <br>

 <%

    String key=request.getParameter("text1");
    for(j=0; j<str.length;j++)
    {
         if(str[j].compareTo(key)==0)
        {
              flag=1;
              break;
        }
    }

    if(flag==1)
        out.println("Search Key Found at location "+(j+1));
    else
        out.println("Search Key Not Found!");


%>
<body>
</html>

03. Program to Search the Given Name Using Binary Search.

//Filename: Search3.html
<!--Html program to read search key-->
<HTML>
    <HEAD>
        <TITLE>Sorting and Searching</TITLE>
    </HEAD>

    <BODY>
        <H1>Program to sort list of names and search for key</H1>
        <FORM ACTION="Search3.jsp" METHOD="POST">
              Please enter your the search key:
            <BR>
           
              <input NAME="text1" type="text">
            <BR>
            <INPUT TYPE="SUBMIT"   VALUE="Submit">
        </FORM>
    </BODY>
<HTML>



//Filename:Search3.jsp
<!--03. Program to search the given name using binary search.-->
<html>
<body>
<%@ page import="java.io.*,java.util.*"%>
<%
    final String str[]={"Pineapple" , "Orange" , "Apple", "Grapes", "Banana"};

    String key=request.getParameter("text1");;
    int index = -1,i;
    int len=str.length;
    Arrays.sort(str);
    Arrays.toString(str);
    index = Arrays.binarySearch(str, key);
       
    %>
    <h3>The sorted list of names:<h3>
   
    <%

        for(i=0;i<len;i++)
        {
            out.println(str[i]);
            %>
            <BR>
            <%

        }
        %>
        <BR>
        <%
        if(index>-1)
        {
            out.println("Key found at location "+(index+1));
        }
        else
        {
            out.println("Key not found!");
        }

%>
</body>
</html>



FREE Hit Counters