BCA

WEB PROGRAMMING LAB

PROGRAM 1 PROGRAM 2 PROGRAM 3 PROGRAM 4 PROGRAM 5 PROGRAM 6 PROGRAM 7 PROGRAM 8 PROGRAM 9 PROGRAM 10 PROGRAM 11 PROGRAM 12 PROGRAM 13 PROGRAM 14 PROGRAM 15 . . .

11. Write a multilayered JSP program to evaluate the result of a student . Consider student name, register number, marks obtained in 5 subjects as input and read them by writing a proper user interface JSP. Evaluate the total marks , percentage marks and the grade by writing a process JSP. while evaluating the grade verify whether the student has cleared all the papers. Display the output with proper marks list by using tag.
OUTPUT: result

MARKS LIST

STUDENT NAME:
REGISTER NO:
SUBJECT 1:
SUBJECT 2:
SUBJECT 3:
SUBJECT 4:
SUBJECT 5:

PAGE 1: program11startpage.html

 
 

	 
<html>
<head>
<title>result</title>
</head>
<body>
<h2> MARKS LIST </h2>
<form action="program11endpage.jsp" method ="post">
<table>
<tr><td> STUDENT NAME: </td><td><input type="text" name="sname"></td></tr>
<tr><td> REGISTER NO: </td><td><input type="text" name="sno"></td></tr>
<tr><td> SUBJECT 1:</td><td><input type="text" name="s1"></td></tr>
<tr><td> SUBJECT 2:</td><td><input type="text" name="s2"></td></tr>
<tr><td> SUBJECT 3:</td><td><input type="text" name="s3"></td></tr>
<tr><td> SUBJECT 4:</td><td><input type="text" name="s4"></td></tr>
<tr><td> SUBJECT 5:</td><td><input type="text" name="s5"></td></tr>
<tr><td colspan=2 align="center"><input type="submit" value="RESULT"></td></tr>
</table>
</form>
</body>
</html>


PAGE 1: program11endpage.jsp

 
 

<html>
<body>
<% String stud_name=request.getParameter("sname");
   String reg_no=request.getParameter("sno");
   int m1=Integer.parseInt(request.getParameter("s1"));
   int m2=Integer.parseInt(request.getParameter("s2"));
   int m3=Integer.parseInt(request.getParameter("s3"));
   int m4=Integer.parseInt(request.getParameter("s4"));
   int m5=Integer.parseInt(request.getParameter("s5"));
   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>");
   %>
   <table align =center>
   <tr><th align=center>SRNM COLLEGE</th></tr>
   <tr><td align=center>MARKS LIST</td></tr>
   </table>
   <b>NAME OF THE STUDENT:</b><%=stud_name%><br>
   <b>REGISTER NUMBER: </b><%=reg_no%>
   <hr>
   <table width=100%>
   <tr><th>SUBJECT</th><th>MAX.MARKS</th><th>MIN.MARKS</th><th>MARKS OBTAINED</th></tr>
   <tr><td colspan=4><hr></tr>
   <tr><td align=center >1.SUBJECT </td> <td align =center>100</td><td align=center>40</td>
   <td align=center><%=m1%></td>
   </tr>
    <tr><td align=center >2.SUBJECT </td> <td align =center>100</td><td align=center>40</td>
   <td align=center><%=m2%></td>
   </tr>
    <tr><td align=center >3.SUBJECT </td> <td align =center>100</td><td align=center>40</td>
   <td align=center><%=m3%></td>
   </tr>
    <tr><td align=center >4.SUBJECT </td> <td align =center>100</td><td align=center>40</td>
   <td align=center><%=m4%></td>
   </tr>
    <tr><td align=center >5.SUBJECT </td> <td align =center>100</td><td align=center>40</td>
   <td align=center><%=m5%></td>
   </tr>
   <tr><td colspan=4><hr></tr>
   <tr>
   <td><b>TOTAL MARKS</td><td align=center>500</td><td align=center>200</td>
   <td align=center><%=total_marks%></td>
   </tr>
   <tr><td><b>PERCENTAGE MARKS</th><td align=center><b><%=percent%>%</th></tr>
   <tr><td><b>GRADE</th><td align=center><b><%=grade%></th></tr>
   </TABLE>
   </body>
   </html>