Search This Blog

Wednesday 29 December 2021

8. Write an HTML and JSP program to accept Feedback from the delegates and save the same into MySQL database.

<!-- 8. HTML Program for collecting Feedback -->

<html>

<head>

<title>Seminar Feedback</title>

</head>

<body bgcolor=gray text=yellow>

<h3>Seminar Feedback Form</h3>

<form action="Prog8.jsp" method=POST>

<table border=3>

<tr align=left>

<th>Delegate Name:</th> <th><input type=text name=dname></th>

</tr>

<tr align=left><th>Delegate Type:</th>

<th>

<select name=dtype>

<option>Staff</option>

<option>Student</option>

</select></th></tr>

<tr align=left><th>Designation:</th>

<th><input type=text value=Student name=desig> </th></tr>

<tr align=left><th>Department:</th>

<th><input type=text name=dept></th></tr>

<tr align=left><th>Address:</th>

<th><textarea name=address></textarea></th></tr>

<tr align=left><th>Phone:</th>

<th><input type=text name=phone></th></tr>

<tr align=center><th colspan=2>Feedback on Seminar</th></tr>

<tr align=left>

<th>How was the content of the Seminar?</th>

<th><select name=q1><option>Excellent</option>

<option>Good</option><option>Satisfactory</option>

</select></th></tr>

<tr align=left>

<th>How would you rate the organization of the Event?</th>

<th>

<select name=q2><option>Excellent</option>

<option>Good</option><option>Satisfactory</option>

</select></th></tr>

<tr align=left>

<th>Did the event meet your Expectations?</th>

<th><select name=q3><option>Yes<option>No</select></th></tr>

<tr align=left>

<th>Would you say the event was Interactive?</th><th>

<select name=q4><option>Yes<option>No</select></th></tr>

<tr align=left>

<th>Overall, how satisfied were you with the event?</th>

<th><select name=q5><option>Very Satisfied<option>Satisfied

<option>Neutral</select></th></tr>

<tr align=center>

<th><input type=Submit value=Submit></th>

<th><input type=reset value=Reset></th></tr>

</table>

</form>

</body>

</html>

 

<!-- 8. JSP Program for collecting Feedback -->

<html>

<head>

<title>Seminar Feedback Form</title>

<%@page import="java.util.*, java.sql.*, java.lang.*" %>

</head>

<body>

<%

     try{

          String dname=request.getParameter("dname");

          String dtype=request.getParameter("dtype");

          String desig=request.getParameter("desig");

          String dept=request.getParameter("dept");

          String address=request.getParameter("address");

     int phone=Integer.parseInt(request.getParameter("phone"));

          String q1=request.getParameter("q1");

          String q2=request.getParameter("q2");

          String q3=request.getParameter("q3");

          String q4=request.getParameter("q4");

          String q5=request.getParameter("q5");

      Class.forName("com.mysql.jdbc.Driver");

Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");

     Statement st=con.createStatement();

     out.println("<h3>Data Saved Successfully!</h3>");

String s="insert into prog8 values('"+dname+"','"+dtype+"','"+desig+"','"+dept+"','"+address+"',"+phone+",'"+q1+"','"+q2+"','"+q3+"','"+q4+"','"+q5+"');";

     st.executeUpdate(s);       

  }

     catch(Exception e)

     {

          //out.println(e);

     out.println("<font color=red size=5>Enter Valid      

     Input!</font>");

     }

%>

</body>

</html>

Wednesday 15 December 2021

7. HTML Program to read Placement details of students & JSP Program to store the same in MySQL Database.

 <!-- 7. HTML Program to read Placement details of student. -->

<html>

 <head>

 <title>Student Information</title>

 </head>

 <body>

 <h3>Enter Student Details:</h3>

 <form action="Prog7.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>Course:</td><td>    <select name="course">

                            <option >BCA</option>

                            <option >BSc</option>

                            <option >BA</option>

                            </select> </td></tr>

 <tr><td>Combination:</td><td>    <select name="comb">

                            <option >Computer Applications</option>

                            <option >PMCs</option>

                            <option >EMCs</option>

                            <option >HSP</option>

                            <option >HEK</option>

                            </select> </td></tr>

 <tr><td>Placement Mode:</td><td>    <select name="mode">

                            <option >OnCampus</option>

                            <option >OffCampus</option>

                            </select> </td></tr>

 <tr><td>Name of Company:</td><td><input type="text" name="cname"></td></tr>

  <tr><td>Employer Type:</td><td>    <select name="etype">

                            <option >Private</option>

                            <option >Government</option>

                            </select> </td></tr>

 <tr><td>Selection Date:</td><td><input type="text" name="sdate">[yyyy-mm-dd]</td></tr>

 <tr><td>Package:</td><td><input type="text" name="pack"></td></tr>

  <tr><td><input type="submit" value="Save in Database" ></td>

 <td><input type="reset" value="Reset" ></td></tr>

 </table>

 </form>

 </body>

</html>

<!-- 7.  JSP Program to store Placement details of Students in MySQL Database. -->

<html>

<head>

<title>Student Information</title>

<%@page import="java.sql.*,java.util.*"%>

</head>

<body>

<%

try

{

    String sname=request.getParameter("sname");

    String regno=request.getParameter("regno");

    String course=request.getParameter("course");

    String comb=request.getParameter("comb");

    String mode=request.getParameter("mode");

    String cname=request.getParameter("cname");

    String etype=request.getParameter("etype");

    String sdate=request.getParameter("sdate");

    int pack=Integer.parseInt(request.getParameter("pack"));

    Class.forName("com.mysql.jdbc.Driver");

    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");

    Statement st=con.createStatement();

    out.println("<h3>Data Saved Successfully!</h3>");

    String s="insert into prog7 values('"+sname+"','"+regno

            +"','"+course+"','"+comb+"','"+mode+"','"+cname+"','"+etype+"','"+sdate+"',"+pack+");";

        st.executeUpdate(s);

      }

    catch(Exception e)

    {

        //out.println("Insertion of data failed!");

        out.println("<H3>Enter Valid Input!</H3>");

    }

%>

</body>

</html>

10. C Program to perform addition and subtraction of Matrices .

 /*10. C Program to perform addition and subtraction of Matrices */

#include<stdio.h>

void main()

{

     int a[10][10],b[10][10],add[10][10],sub[10][10],i,j,m,n;

     clrscr();

     printf("Enter the order of matrix\n");

     scanf("%d%d",&m,&n);

     printf("Enter the elements of first matrix:\n");

     for(i=0;i<m;i++)

     {

          for(j=0;j<n;j++)

          {

              scanf("%d",&a[i][j]);

          }

     }

     printf("Enter the elements of second matrix:\n");

     for(i=0;i<m;i++)

     {

          for(j=0;j<n;j++)

          {

              scanf("%d",&b[i][j]);

          }

     }

     for(i=0;i<m;i++)

     {

          for(j=0;j<n;j++)

          {

              add[i][j]=a[i][j]+b[i][j];

              sub[i][j]=a[i][j]-b[i][j];

          }

     }

     printf("Matrix Addition:\n");

     for(i=0;i<m;i++)

     {

          for(j=0;j<n;j++)

          {

              printf("%d\t",add[i][j]);

          }

          printf("\n");

     }

     printf("Matrix Subtraction:\n");

     for(i=0;i<m;i++)

     {

          for(j=0;j<n;j++)

          {

              printf("%d\t",sub[i][j]);

          }

          printf("\n");

     }

     getch();

}

9. Write a C Program to remove Duplicate Element in a single dimensional Array.

 /*9. Write a C Program to remove Duplicate Element in a single dimensional Array.*/

#include <stdio.h>

void main()

{

    int arr[20];   // Declare an array of size 20

    int size;

    int i, j, k;       // Loop control variables

    clrscr();

 

    printf("Enter size of the array:");

    scanf("%d", &size); // Read size of the array

 

    printf("Enter elements in array:\n");

    for(i=0; i<size; i++)  // Read array elements

    {

        scanf("%d", &arr[i]);

    }

 

    //Find duplicate elements in the array

    for(i=0; i<size; i++)

    {

     for(j=i+1; j<size; j++)

     {

         // Check for duplicate elements

         if(arr[i] == arr[j])

         {

          // Delete the current duplicate element

                for(k=j; k < size - 1; k++)

                {

                    arr[k] = arr[k + 1];

                }

          // Decrement size after removing duplicate element

                size--;

          j--;

            }

        }

    }

 

    //Display array after deleting duplicate elements

    printf("\nArray elements after deleting duplicates: ");

    for(i=0; i<size; i++)

    {

     printf("%d\t", arr[i]);

    }

 

    getch();    

}

8. Write a C program to read marks scored in 3 subjects by n students and find the average of marks and result (Demonstration of single dimensional array)

 /* 8. Write a C program to read marks scored in 3 subjects by n students and find the average of marks and result (Demonstration of single dimensional array) */

#include<stdio.h>

void main()

{

     int sub1[10],sub2[10],sub3[10],total[10],avg[10],n,i;

     printf("Enter no of students:");

     scanf("%d",&n);

     for(i=0;i<n;i++)

     {

          printf("Enter the marks of Student-%d:\n",i+1);

          scanf("%d",&sub1[i]);

          scanf("%d",&sub2[i]);

          scanf("%d",&sub3[i]);

          total[i]=sub1[i]+sub2[i]+sub3[i];

          avg[i]=total[i]/n;

     }

     printf("Results are as follows:\n");

     for(i=0;i<n;i++)

     {

          printf("Student-%d is as follows:\n",i+1);

          if((total[i]*100/300)>=70)

              printf("Distinction\n");

          else if((total[i]*100/300)>=60)

              printf("First Class\n");

          else if((total[i]*100/300)>=50)

              printf("Second Class\n");

          else if((total[i]*100/300)>=40)

              printf("Pass\n");

          else

              printf("Fail\n");

     }

     getch();

}

FREE Hit Counters