Monday 3 April 2017

Develop jsp program to display the grade of a student by accepting the marks of five subject

*File Name

        - Marks.html :Insert five subject marks.
        - marks.jsp: obtaining grade 

*Code

-marks.html

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
       
    </head>
    <body>
    <center>
        <h1>Student marks</h1>
        <form action="marks.jsp" method="get">
           Enter Makrs in 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>
        </center>
    </body>
</html>


*Marks.jsp



<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</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;
        
           
         if(avg > 90 )
         {
             out.println(" your grade is A");
         }else if (avg >= 80) {
           out.println("your grade is b");
        } else if (avg >= 70) {
            out.println("your grade is c");
        } else if (avg >= 60) {
             out.println("your grade is d");
        } else {
             out.println("your grade is e");
       }
       %>
    </body>
</html>



OUTPUT





Thanks ;)

Happy Coding 

 









 






 
 

3 comments:

  1. As we know there are many companies which are converting into Big data service providers. with the right direction we can definitely predict the future.

    ReplyDelete
  2. This is really a helpful blog I am really impressed with your work, keep it up the good work
    Oracle Java Certifications

    ReplyDelete
  3. Nice Blog, Thanks for sharing such a informative blog with us. keep sharing!!

    Are you looking for free online java tutorial?


    free java tutorial!


    hello java programing

    ReplyDelete