5.3 Develop a JSP program to display the grade of a student by accepting the marks of five subjects.
index.html
<!DOCTYPE html><!--To change this license header, choose License Headers in Project Properties.To change this template file, choose Tools | Templatesand open the template in the editor.--><html><head><title>Marks</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"></head><body><p>Enter Marks</p><form action="result.jsp" method="get">Enter Makrs in Advanced Java : <input type="text" name="java"> <br><br>Enter NMA Marks : <input type="text" name="NMA"><br><br>Enter MCAD Marks : <input type="text" name="MCAD"><br><br>Enter PPUD Marks : <input type="text" name="PPUD"><br><br>Enter Project Marks : <input type="text" name="pro"><br><br><input type="submit"></form></body></html>
<%--Document : resultCreated on : 27-Oct-2021, 11:49:40 AMAuthor : arpit--%><%@page contentType="text/html" pageEncoding="UTF-8"%><!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Result</title></head><body><%int java=Integer.parseInt(request.getParameter("java"));int NMA=Integer.parseInt(request.getParameter("NMA"));int MCAD=Integer.parseInt(request.getParameter("MCAD"));int PPUD=Integer.parseInt(request.getParameter("PPUD"));int Project=Integer.parseInt(request.getParameter("pro"));int c=java+NMA+MCAD+PPUD+Project;double avg=c/5;out.print("Your grade is ");if(avg > 90 ){out.print("A");}else if (avg >= 80) {out.print("B");} else if (avg >= 70) {out.print("C");} else if (avg >= 60) {out.print("D");} else {out.print("E");}%></body></html>
0 Comments
Post a Comment