Search This Blog

Thursday 4 September 2014

24. HTML and JSP Program to Evaluate Salary Details of an Employee and Store in Database

Filename: Employee24.html
<!-- 24. Program to accept Employee Details. -->
<html>
 <head>

 <title>Employee Details</title>
 </head>
 <body>
 <h3>Enter Employee Details:<h3>
 <form action="emp24.jsp" method="POST" >
 <table >
 <tr><td>Employee Name:</td><td><input type="text" name="ename" autofocus></td></tr>
 <tr><td>Employee ID:</td><td><input type="text" name="empid"></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 & Store"></td>
 <td><input type="reset" value="Reset"></td></tr>
 </table>
 
 </body>
</html>


Filename: Employee24.jsp
<!-- 24. JSP Program to Evaluate Salary Details of an Employee and Store in Database.-->
<html>
<head>
<%@ page import="java.sql.*" %>
</head>
<body bgcolor="beige">

<%
   
    String ename=request.getParameter("ename");
    String empid=request.getParameter("empid");
    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;
   
    try
    {
        out.println("<h2>Information Stored Successfully!</h2>");
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection con=DriverManager.getConnection("jdbc:odbc:emp24");
        Statement st=con.createStatement();
        String s="insert into emp24 values('"+ename+"','"+empid+"','"+dept+"','"+des+"',"
            +bsal+","+ta2+","+da2+","+hra2+","+allowance+","+gsal+","+pf2+","+lic2+","
            +deduction+","+netsal+");";
        st.executeQuery(s);
    }
    catch(Exception e)
    {
        //out.println(e);
    }
%>
</body>
</html>
 


23. HTML and JSP Program to Evaluate and Store Student Information in the Database.

Filename: Stud23.html

<!-- 23. Program to read student info. and store into database -->
<html>
 <head>

 <title>Student Information</title>
 </head>
 <body>
 <h3>Enter Student Details:<h3>
 <form action="Stud23.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>Course:</td><td>    <select name="course">
                            <option value="BCA">BCA</option>
                            <option value="BSc">BSc</option>
                            <option value="BA">BA</option>
                            </select> </td></tr>

 <tr><td>Combination:</td><td>    <select name="comb">
                            <option value="Computer Applications">Computer Applications</option>
                            <option value="PMCs">PMCs</option>
                            <option value="EMCs">EMCs</option>
                            <option value="HSP">HSP</option>
                            <option value="HEK">HEK</option>
                            </select> </td></tr>
 <tr><td>Semester:</td><td>    <select name="sem">
                            <option value="I">I</option>
                            <option value="II">II</option>
                            <option value="III">III</option>
                            <option value="IV">IV</option>
                            <option value="V">V</option>
                            <option value="VI">VI</option>
                            </select> </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="Save in Database" ></td>
 <td><input type="reset" value="Reset" ></td></tr>
 </table>
 </body>
</html>

Filename: Stud23.jsp
<!-- 23. JSP Program to Evaluate and Store Student Information in the Database. -->
<html>
<head>
<title>Student Information</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<%
    String sname=request.getParameter("sname");
    String regno=request.getParameter("regno");
    String course=request.getParameter("course");
    String comb=request.getParameter("comb");
    String sem=request.getParameter("sem");
    int sub1=Integer.parseInt(request.getParameter("sub1"));
    int sub2=Integer.parseInt(request.getParameter("sub2"));
    int sub3=Integer.parseInt(request.getParameter("sub3"));
    int sub4=Integer.parseInt(request.getParameter("sub4"));
    int sub5=Integer.parseInt(request.getParameter("sub5"));
   
    int total=sub1+sub2+sub3+sub4+sub5;
    float percent;
    String grade="";
    percent = (float)(total*100) / 500;
   
    if(sub1<40 || sub2<40 || sub3<40 || sub4<40 || sub5<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";
           
    }

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:stud23");
    Statement st=con.createStatement();
    try
    {
        out.println("<h3>Data Saved Successfully!</h3>");
        String s="insert into stud23 values('"+sname+"','"+regno
            +"','"+course+"','"+comb+"','"+sem+"',"+sub1
            +","+sub2+","+sub3+","+sub4+","+sub5+","+total+","+percent+",'"+grade+"');";
        st.executeQuery(s);
       
    }
    catch(Exception e)
    {
        //out.println("Insertion of data failed!");
        //out.println(e);
    }
   
   
%>
</body>
</html>






22. HTML and JSP Program to Store Student Information in the Database.

Filename:Stud22.html
<!-- 22. Program to read student info. and store into database -->
<html>
 <head>

 <title>Student Information</title>
 </head>
 <body>
 <h3>Enter Student Details:<h3>
 <form action="Stud22.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>Course:</td><td>    <select name="course">
                            <option value="BCA">BCA</option>
                            <option value="BSc">BSc</option>
                            <option value="BA">BA</option>
                            </select> </td></tr>

 <tr><td>Combination:</td><td>    <select name="comb">
                            <option value="Computer Applications">Computer Applications</option>
                            <option value="PMCs">PMCs</option>
                            <option value="EMCs">EMCs</option>
                            <option value="HSP">HSP</option>
                            <option value="HEK">HEK</option>
                            </select> </td></tr>
 <tr><td>Semester:</td><td>    <select name="sem">
                            <option value="I">I</option>
                            <option value="II">II</option>
                            <option value="III">III</option>
                            <option value="IV">IV</option>
                            <option value="V">V</option>
                            <option value="VI">VI</option>
                            </select> </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="Save in Database" ></td>
 <td><input type="reset" value="Reset" ></td></tr>
 </table>
 </body>
</html>


Filename:Stud22.jsp
<!-- 22. JSP Program to store Student Information in the Database. -->
<html>
<head>
<title>Student Information</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<%
    String sname=request.getParameter("sname");
    String regno=request.getParameter("regno");
    String course=request.getParameter("course");
    String comb=request.getParameter("comb");
    String sem=request.getParameter("sem");
    int sub1=Integer.parseInt(request.getParameter("sub1"));
    int sub2=Integer.parseInt(request.getParameter("sub2"));
    int sub3=Integer.parseInt(request.getParameter("sub3"));
    int sub4=Integer.parseInt(request.getParameter("sub4"));
    int sub5=Integer.parseInt(request.getParameter("sub5"));
   

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:stud22");
    Statement st=con.createStatement();
    try
    {
        out.println("<h3>Data Saved Successfully!</h3>");
        String s="insert into stud22 values('"+sname+"','"+regno
            +"','"+course+"','"+comb+"','"+sem+"',"+sub1
            +","+sub2+","+sub3+","+sub4+","+sub5+");";
        st.executeQuery(s);
       
    }
    catch(Exception e)
    {
        //out.println("Insertion of data failed!");
        //out.println(e);
    }
   
   
%>
</body>
</html>
 


16. HTML and JSP Program to Retrieve Employee Information from the Database.

Filename: Employee16.html
<!-- 16. HTML Program to accept Employee Name -->
<html>
 <head>

 <title>Employee Salary Statement</title>
 </head>
 <body>
 <h3>Enter the Name of Employee:<h3>
 <form action="Employee16.jsp" method="POST" >

    <input type="text" name="ename" autofocus><br><br>
    <input type="submit" value="Generate Statement">
  
 </body>
</html>

Filename: Employee16.jsp
<!-- 16. JSP Program to Retrieve Employee Information from the Database. -->
<html>
<head>
<title>Employee Salary Statement</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<%
    String ename=request.getParameter("ename");

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:emp16");
    Statement st=con.createStatement();
   
    ResultSet rs=st.executeQuery("select * from emp16 where ename='"+ename+"'");
   
    while(rs.next())
    {
%>
    <CENTER>
    <table border=5 bgcolor="orange" height=600 width=400 >
    <caption><h2><font color="blue" >SALARY STATEMENT</font></h2></caption>
    <tr><td>Name</td><td><%=rs.getString("ename")%></td></tr>
    <tr><td>Department</td><td><%=rs.getString("dept")%></td></tr>
    <tr><td>Designation</td><td><%=rs.getString("des")%></td></tr>
    <tr><td>Basic Salary</td><td><%=rs.getString("bsal")%></td></tr>
    <tr><td>TA</td><td><%=rs.getString("ta")%></td></tr>
    <tr><td>DA</td><td><%=rs.getString("da")%></td></tr>
    <tr><td>HRA</td><td><%=rs.getString("hra")%></td></tr>
    <tr><td>Gross Salary</td><td><%=rs.getString("gsal")%></td></tr>
    <tr><td>PF</td><td><%=rs.getString("pf")%></td></tr>

    <tr><td>IT</td><td><%=rs.getString("it")%></td></tr>
    <tr><td>Net Salary</td><td><%=rs.getString("netsal")%></td></tr>
    </table>
    </CENTER>

<%
    }
   

    rs.close();
    st.close();
    con.close();

%>

</body>
</html>

15. JSP Program to Evaluate Salary Details of an Employee and Store into Database.

Filename: Employee15.jsp
<!-- 15. JSP Program to Evaluate Salary Details of an Employee and Store into Database. -->
<html>
<head>
<%@ page import="java.sql.*" %>
</head>
<body bgcolor="beige">

<%
   
    String ename="Mahesh7";
    String dept="Finance";
    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;
   
    try
    {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
       
        Connection con=DriverManager.getConnection("jdbc:odbc:sal15");
       
        Statement st=con.createStatement();
       
        String s="insert into sal15 values('"+ename+"','"+dept+"','"+des+"',"
        +bsal+","+allowance+","+gsal+","+deduction+","+netsal+");";
       
        out.println("<h3>Employee Details Stored in the Database Successfully!</h3>");
       
        st.executeQuery(s);
   
    }
    catch(Exception e)
    {
        //out.println(e);
    }

%>

</body>
</html>

14. JSP Program to Generate Marks Sheets of all the Students from the Database.

Filename: Stud14.jsp
<!-- 14. JSP Program to Generate Marks Sheets of all the Students from the Database. -->
<html>
<head>
<title>Student Information</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<CENTER><h2><font color="blue" >Marks Sheets of all the Students</font></h2></CENTER>

<%
    String sname=request.getParameter("sname");

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:stud14");
    Statement st=con.createStatement();
   
    ResultSet rs=st.executeQuery("select * from stud14");
   
    while(rs.next())
    {
%>
    <CENTER>
    <table border=5 bgcolor="orange" height=600 width=400 >
    <caption><h3><font color="blue" >Marks Sheet</font></h3></caption>
    <tr><td>Name</td><td><%=rs.getString("sname")%></td></tr>
    <tr><td>Register Number</td><td><%=rs.getString("regno")%></td></tr>
    <tr><td>Course</td><td><%=rs.getString("course")%></td></tr>
    <tr><td>Subject1</td><td><%=rs.getString("sub1")%></td></tr>
    <tr><td>Subject2</td><td><%=rs.getString("sub2")%></td></tr>
    <tr><td>Subject3</td><td><%=rs.getString("sub3")%></td></tr>
    <tr><td>Subject4</td><td><%=rs.getString("sub4")%></td></tr>
    <tr><td>Subject5</td><td><%=rs.getString("sub5")%></td></tr>
    <tr><td>Total</td><td><%=rs.getString("total")%></td></tr>

    <tr><td>Percent</td><td><%=rs.getString("percent")%></td></tr>
    <tr><td>Grade</td><td><%=rs.getString("grade")%></td></tr>
    </table>
    </CENTER>
    <br>

<%
    }
   

    rs.close();
    st.close();
    con.close();

%>

</body>
</html>

13. HTML and JSP Program to Retrieve Student Information from the Database.

Filename:Stud13.html
<!-- 13. HTML Program to accept Student name -->
<html>
 <head>

 <title>Student Marks Sheet</title>
 </head>
 <body>
 <h3>Enter the Name of Student:<h3>
 <form action="Stud13.jsp" method="POST" >

    <input type="text" name="sname" autofocus><br><br>
    <input type="submit" value="Get Details">

 
 </body>
</html>

Filename:Stud13.jsp
<!-- 13. JSP Program to Retrieve Student Information from the Database. -->
<html>
<head>
<title>Student Information</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<%
    String sname=request.getParameter("sname");

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:stud13");
    Statement st=con.createStatement();
   
    ResultSet rs=st.executeQuery("select * from stud13 where sname='"+sname+"'");
   
    while(rs.next())
    {
%>
    <CENTER>
    <table border=5 bgcolor="orange" height=600 width=400 >
    <caption><h2><font color="blue" >Marks Sheet</font></h2></caption>
    <tr><td>Name</td><td><%=rs.getString("sname")%></td></tr>
    <tr><td>Register Number</td><td><%=rs.getString("regno")%></td></tr>
    <tr><td>Course</td><td><%=rs.getString("course")%></td></tr>
    <tr><td>Subject1</td><td><%=rs.getString("sub1")%></td></tr>
    <tr><td>Subject2</td><td><%=rs.getString("sub2")%></td></tr>
    <tr><td>Subject3</td><td><%=rs.getString("sub3")%></td></tr>
    <tr><td>Subject4</td><td><%=rs.getString("sub4")%></td></tr>
    <tr><td>Subject5</td><td><%=rs.getString("sub5")%></td></tr>
    <tr><td>Total</td><td><%=rs.getString("total")%></td></tr>

    <tr><td>Percent</td><td><%=rs.getString("percent")%></td></tr>
    <tr><td>Grade</td><td><%=rs.getString("grade")%></td></tr>
    </table>
    </CENTER>

<%
    }
   

    rs.close();
    st.close();
    con.close();

%>

</body>
</html>

12. HTML and JSP Program to Read Student Information and Store into Database.

Filename: Stud12.html
<!-- 12. Program to read student info. and store into database -->
<html>
 <head>

 <title>Student Information</title>
 </head>
 <body>
 <h3>Enter Student Details:<h3>
 <form action="Stud12.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>Course:</td><td><input type="text" name="course"></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: Stud12.jsp
<!-- 12. JSP Program to store Student Information in the Database. -->
<html>
<head>
<title>Student Information</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<%
    String sname=request.getParameter("sname");
    String regno=request.getParameter("regno");
    String course=request.getParameter("course");
    int sub1=Integer.parseInt(request.getParameter("sub1"));
    int sub2=Integer.parseInt(request.getParameter("sub2"));
    int sub3=Integer.parseInt(request.getParameter("sub3"));
    int sub4=Integer.parseInt(request.getParameter("sub4"));
    int sub5=Integer.parseInt(request.getParameter("sub5"));
    int total=sub1+sub2+sub3+sub4+sub5;
    float percent;
    String grade="";
        percent = (float)(total*100) / 500;
   
        if(sub1<40 || sub2<40 || sub3<40 || sub4<40 || sub5<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";
           
        }

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:stud12");
    Statement st=con.createStatement();
    try
    {
        out.println("<h3>Data successfully inserted.</h3>");
        String s="insert into stud12 values('"
        +sname+"','"+regno+"','"+course+"',"+sub1+","+sub2+","+sub3+","+sub4+","
        +sub5+","+total+","+percent+",'"+grade+"');";
            st.executeQuery(s);
       
    }
    catch(Exception e)
    {
        //out.println("Insertion of data failed!");
        //out.println(e);
    }
   
   
%>
</body>
</html>
 


11. HTML and JSP Program to Read Student Information and Store into Database.

Filename: Stud11.html
<!-- 11. Program to read student information and store into database -->
<html>
 <head>

 <title>Student Information</title>
 </head>
 <body>
 <h3>Enter Student Details:<h3>
 <form action="Stud11.jsp" method="POST" >
 <table >
 <tr><td>Student 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>Course:</td><td><input type="text" name="course"></td></tr>
 <tr><td>College:</td><td><input type="text" name="college"></td></tr>
 <tr><td>City:</td><td><input type="text" name="city"></td></tr>
 <tr><td>Phone:</td><td><input type="text" name="phone"></td></tr>
 <tr><td><input type="submit" value="Store in Database"></td><td><input type="reset" value="Reset"></td></tr>
 </table>
 
 </body>
</html>


Filename:Stud11.jsp
<!-- 11. JSP Program to store student information in the database. -->
<html>
<head>
<title>Student Information</title>
<%@page import="java.sql.*,java.util.*"%>
</head>
<body>
<%
    String sname=request.getParameter("sname");
    String regno=request.getParameter("regno");
    String course=request.getParameter("course");
    String college=request.getParameter("college");
    String city=request.getParameter("city");
    String phone=request.getParameter("phone");
    int len=phone.length();
   
   
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:stud1");
    Statement st=con.createStatement();
    if(len<=10)
    {
        try
        {
            out.println("Data successfully inserted.");
            String s="insert into Student values('"
            +sname+"','"+regno+"','"+course+"','"+college+"','"+city+"','"+phone+"');";
                st.executeQuery(s);
       
        }
        catch(Exception e)
        {
            //out.println("Insertion of data failed!");
            //out.println(e);
        }
    }
    else
    {
        out.println("Invalid Phone Number");
    }

%>

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>
FREE Hit Counters