3. 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 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 format by using <TABLE> tag.
College Name
College Name
Marks List
Name of the Student :
Register Number :
Subjects Max. Marks Min. Marks
Marks Obtained
1. Subject1 100 40 --
2. Subject2 100 40 --
3. Subject3 100 40 --
4. Subject4 100 40 --
5. Subject5 100 40 --
Total Marks 500 200 --
Percentage Marks: -- %
Grade: ----
Code for Stud11.html:
<!-- 11. HTML Program to
read student information -->
<html>
<head>
<title>Student Information</title>
</head>
<body>
<h3>Enter Student Details:</h3>
<form action="Stud11.jsp"
method="POST" >
<table >
<tr><td>Name:</td><td><input type="text"
name="sname" ></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>
Code for Stud11.jsp:
<!-- 11. 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 >
<caption><font color="blue"
size=14>College Name<br>Marks List</font></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>
No comments :
Post a Comment