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>
Registrati no has null
ReplyDelete