Search This Blog

Sunday, 24 August 2014

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>

 

1 comment :

  1. The main motive of the Big data service providers is to spread the knowledge so that they can give more big data engineers to the world.

    ReplyDelete

FREE Hit Counters