<!-- 17. JSP Program to Evaluate the Result of a Student and Display using <TABLE> tag. -->
<html>
<body>
<%!
//Initialize all the values in the beginning.
String stud_name="ARJUN";
String course="BCA";
String sem="V Sem";
String reg_no="BC112033";
int m1=95;
int m2=95;
int m3=96;
int m4=95;
int m5=65;
int total_marks;
float percent;
String grade;
%>
<%
//evaluate grade in this section.
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>");
%>
<CENTER>
<CAPTION><H2>MARKS LIST</H2></CAPTION>
<TABLE BORDER=5 BGCOLOR="ORANGE" HEIGHT=500 WIDTH=300>
<TR><TD>NAME</TD><TD><%=stud_name%></TD></TR>
<TR><TD>REGISTER NUMBER</TD><TD><%=reg_no%></TD></TR>
<TR><TD>SUBJECT1</TD><TD><%=m1%></TD></TR>
<TR><TD>SUBJECT2</TD><TD><%=m2%></TD></TR>
<TR><TD>SUBJECT3</TD><TD><%=m3%></TD></TR>
<TR><TD>SUBJECT4</TD><TD><%=m4%></TD></TR>
<TR><TD>SUBJECT5</TD><TD><%=m5%></TD></TR>
<TR><TD>TOTAL MARKS</TD><TD><%=total_marks%></TD></TR>
<TR><TD>PERCENT</TD><TD><%=percent%></TD></TR>
<TR><TD>GRADE</TD><TD><%=grade%></TD></TR>
</TABLE>
</CENTER>
</body>
</html>
<html>
<body>
<%!
//Initialize all the values in the beginning.
String stud_name="ARJUN";
String course="BCA";
String sem="V Sem";
String reg_no="BC112033";
int m1=95;
int m2=95;
int m3=96;
int m4=95;
int m5=65;
int total_marks;
float percent;
String grade;
%>
<%
//evaluate grade in this section.
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>");
%>
<CENTER>
<CAPTION><H2>MARKS LIST</H2></CAPTION>
<TABLE BORDER=5 BGCOLOR="ORANGE" HEIGHT=500 WIDTH=300>
<TR><TD>NAME</TD><TD><%=stud_name%></TD></TR>
<TR><TD>REGISTER NUMBER</TD><TD><%=reg_no%></TD></TR>
<TR><TD>SUBJECT1</TD><TD><%=m1%></TD></TR>
<TR><TD>SUBJECT2</TD><TD><%=m2%></TD></TR>
<TR><TD>SUBJECT3</TD><TD><%=m3%></TD></TR>
<TR><TD>SUBJECT4</TD><TD><%=m4%></TD></TR>
<TR><TD>SUBJECT5</TD><TD><%=m5%></TD></TR>
<TR><TD>TOTAL MARKS</TD><TD><%=total_marks%></TD></TR>
<TR><TD>PERCENT</TD><TD><%=percent%></TD></TR>
<TR><TD>GRADE</TD><TD><%=grade%></TD></TR>
</TABLE>
</CENTER>
</body>
</html>
No comments :
Post a Comment