Thursday, July 26, 2018

ASSIGNMENT-1 :: IInd CSE-1 ,last date to submit: 28-07-18

-----------------------------------------------------------------
ASSIGNMENT-1 :: IInd CSE-1 ,last date to submit: 28-07-18
-----------------------------------------------------------------
1)
a)Write data structures in java with examples.
b)Discuss control loops with examples.
2)
a)Write R-code to return complex object.
b)Write R-code to implement binary search tree.
3)
a)Discuss quick sort implementation with example.
b)Solve the linear equations.
x1+x2=2
-x1+x2=4
---------------------------------------------------------
Discuss all with full explanation.
note :: use A4 sheets only


Saturday, July 21, 2018

3rd CSE - 2 JFRAME n sql conect

import java.sql.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class odframe extends JFrame implements
ActionListener
{
        Connection c;
        Statement st;
        ResultSet rs;
        JFrame f;
        TextField t1,t2,t3;
        Button b1,b2,b3,b4,b5,b6,b7;
        Label l1,l2,l3;
        Panel p;
        TextArea ta;

 public void actionPerformed(ActionEvent ae1)
 {
     Button bt=(Button)ae1.getSource();
       if(bt.getLabel().equals("Load"))
         Load();
 
       if(bt.getLabel().equals("Next"))
         Next();
 
        if(bt.getLabel().equals("Get"))
         Get();
 
        if(bt.getLabel().equals("Add"))
         Add();
 
        if(bt.getLabel().equals("Delete"))
         Delete();
       
        if(bt.getLabel().equals("Clear"))
                         Clear();

        if(bt.getLabel().equals("Update"))
       
                Update();
     
  }
 
  public odbcframe()
  {
           f=new JFrame("file server");
        f.setSize(320,300);
        f.setBackground(Color.gray);
        f.setForeground(Color.magenta);
        p=new Panel();
        b1=new Button("Load");
        b2=new Button("Next");
        b3=new Button("Get");
        b4=new Button("Update");
        b5=new Button("Add");
        b6=new Button("Delete");
        b7=new Button("Clear");
        b1.addActionListener(this);
        b2.addActionListener(this);
        b3.addActionListener(this);
        b4.addActionListener(this);
        b5.addActionListener(this);
        b6.addActionListener(this);
        b7.addActionListener(this);
        t1=new TextField("       ");
        t2=new TextField("       ");
        t3=new TextField("       ");
        l1=new Label("Empno");
        l2=new Label("Ename");
        l3=new Label("Salary");
        ta=new TextArea(10,30);
        f.add(p);
        p.add(l1);
        p.add(t1);
        p.add(l2);
        p.add(t2);
        p.add(l3);
        p.add(t3);
           p.add(b1);
           p.add(b2);
           p.add(b3);
           p.add(b4);
           p.add(b5);
           p.add(b6);
           p.add(b7);
           p.add(ta);
        f.setVisible(true);
        f.setDefaultCloseOperation

(JFrame.EXIT_ON_CLOSE);
  }
  void Load()
  {
        try
        {
     Class.forName("com.mysql.jdbc.Driver");
     c=DriverManager.getConnection( 
"jdbc:mysql://localhost:3306/employee","root","1234")

;
     st=c.createStatement();

     rs=st.executeQuery("select *from emp");
     //rs.setFetchDirection

//(ResultSet.TYPE_SCROLL_SENSITIVE);

        rs.next();
        t1.setText(rs.getString("eno"));
        t2.setText(rs.getString("ename"));
        t3.setText(rs.getString("sal"));
       }
        catch(Exception e)
        {
        e.toString();
        }
   }

   public void Next()
   {
        try
        {
        rs.next();
        t1.setText(rs.getString("eno"));
        t2.setText(rs.getString("ename"));
        t3.setText(rs.getString("sal"));
        }
        catch(Exception e)
        {
        ta.append("No Next Record...");
        }
   }
   public void Get()
   {
        try
        {
rs=st.executeQuery("select * from emp where eno=" +

t1.getText());
        rs.next();
        t1.setText(rs.getString("eno"));
        t2.setText(rs.getString("ename"));
        t3.setText(rs.getString("sal"));
        }
        catch(Exception e)
        {
        ta.append("No Prev Record...");
        ta.append(e.toString());
           }
   }

   public void Add()
   {
   try
   {
   rs=st.executeQuery("insert into emp values

("+t1.getText()+",'"+t2.getText()+"',"+t3.getText

()+")");
   }
        catch(Exception e)
        {
        ta.append(e.toString());
        }
  }
   public void Clear()
   {
        try
        {
        rs.next();
        t1.setText(" ");
        t2.setText(" ");
        t3.setText(" ");
        }
        catch(Exception e)
        {
        ta.append(e.toString());
        }
    }
   public void Delete()
   {
        try
        {
        rs=st.executeQuery("delete from emp where 

eno="+t1.getText());
        }
        catch(Exception e)
        {
        ta.append(e.toString());
        }
    }
   public void Update()
   {
        try
        {
        rs=st.executeQuery("update emp set 

ename="+"'"+t2.getText()+"' where eno="+t1.getText

());
        }
        catch(Exception e)
        {
        ta.append(e.toString());
        }
    }

   public static void main(String args[])
   {
    new odframe();
    }
 } 

Friday, July 20, 2018

JFrame connect with Database

import java.sql.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class odframe extends JFrame implements ActionListener
{
        Connection c;
        Statement st;
        ResultSet rs;
        JFrame f;
        TextField t1,t2,t3;
        Button b1,b2,b3,b4,b5,b6,b7;
        Label l1,l2,l3;
        Panel p;
        TextArea ta;

 public void actionPerformed(ActionEvent ae1)
 {
     Button bt=(Button)ae1.getSource();
       if(bt.getLabel().equals("Load"))
         Load();
 
       if(bt.getLabel().equals("Next"))
         Next();
 
        if(bt.getLabel().equals("Get"))
         Get();
 
        if(bt.getLabel().equals("Add"))
         Add();
 
        if(bt.getLabel().equals("Delete"))
         Delete();
       
        if(bt.getLabel().equals("Clear"))
                         Clear();

        if(bt.getLabel().equals("Update"))
       
                Update();
       
  }
 
  public odframe()
  {
           f=new JFrame("file server");
        f.setSize(320,300);
        f.setBackground(Color.gray);
        f.setForeground(Color.magenta);
        p=new Panel();
        b1=new Button("Load");
        b2=new Button("Next");
        b3=new Button("Get");
        b4=new Button("Update");
        b5=new Button("Add");
        b6=new Button("Delete");
        b7=new Button("Clear");
        b1.addActionListener(this);
        b2.addActionListener(this);
        b3.addActionListener(this);
        b4.addActionListener(this);
        b5.addActionListener(this);
        b6.addActionListener(this);
        b7.addActionListener(this);
        t1=new TextField("       ");
        t2=new TextField("       ");
        t3=new TextField("       ");
        l1=new Label("Empno");
        l2=new Label("Ename");
        l3=new Label("Salary");
        ta=new TextArea(10,30);
        f.add(p);
        p.add(l1);
        p.add(t1);
        p.add(l2);
        p.add(t2);
        p.add(l3);
        p.add(t3);
           p.add(b1);
           p.add(b2);
           p.add(b3);
           p.add(b4);
           p.add(b5);
           p.add(b6);
           p.add(b7);
           p.add(ta);
        f.setVisible(true);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
  void Load()
  {
        try
        {
     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     c=DriverManager.getConnection("jdbc:odbc:connect_ora","scott","tiger");
     st=c.createStatement();

     rs=st.executeQuery("select *from appu");
     //rs.setFetchDirection(ResultSet.TYPE_SCROLL_SENSITIVE);

        rs.next();
        t1.setText(rs.getString("empno"));
        t2.setText(rs.getString("ename"));
        t3.setText(rs.getString("sal"));
       }
        catch(Exception e)
        {
        e.toString();
        }
   }

   public void Next()
   {
        try
        {
        rs.next();
        t1.setText(rs.getString("empno"));
        t2.setText(rs.getString("ename"));
        t3.setText(rs.getString("sal"));
        }
        catch(Exception e)
        {
        ta.append("No Next Record...");
        }
   }
   public void Get()
   {
        try
        {
        rs=st.executeQuery("select *from appu where empno="+t1.getText());
        rs.next();
        t1.setText(rs.getString("empno"));
        t2.setText(rs.getString("ename"));
        t3.setText(rs.getString("sal"));
        }
        catch(Exception e)
        {
        ta.append("No Prev Record...");
        ta.append(e.toString());
           }
   }

   public void Add()
   {
   try
   {
   rs=st.executeQuery("insert into appu values("+t1.getText()+",'"+t2.getText()+"',"+t3.getText()+")");
   }
        catch(Exception e)
        {
        ta.append(e.toString());
        }
  }
   public void Clear()
   {
        try
        {
        rs.next();
        t1.setText(" ");
        t2.setText(" ");
        t3.setText(" ");
        }
        catch(Exception e)
        {
        ta.append(e.toString());
        }
    }
   public void Delete()
   {
        try
        {
        rs=st.executeQuery("delete from appu where empno="+t1.getText());
        }
        catch(Exception e)
        {
        ta.append(e.toString());
        }
    }
   public void Update()
   {
        try
        {
        rs=st.executeQuery("update appu set ename="+"'"+t2.getText()+"' where empno="+t1.getText());
        }
        catch(Exception e)
        {
        ta.append(e.toString());
        }
    }

   public static void main(String args[])
   {
    new odframe();
    }
 } 

Friday, July 13, 2018

Question Bank in R – PROGRAMMING By RVS UNIT-1

Question Bank in R – PROGRAMMING By RVS
UNIT-1
           1.           List the data structures in R with examples.
2.       Write syntax of if else in R.
3.       Write any 3 math functions in R.
4.       Explain Datatypes in R
5.       List the differences between vector and list.
6.       Calculate the cummulative sum and cummulative product for the given data 23, 1, 7, -2, 8,
7.       10, 17
8.       Explain in detail about dataframe and arrays with example R code.
9.       Write R code to generate first n terms of a Fibonacci series
10.   Create a 3-dimensional array in R.
11.   Find the minimum and maximum for 14, 23, 16, 20, 0, -17, 100
12.   Create a simple matrix with 3X3 size in R.
13.   Find the factorial of 6. Find the mean, median, standard deviation of
14.   2,4,9,10,14,28,52.
15.   Explain dnorm() function
16.   What is a vector in R? Explain operations on vectors.
17.   Write R function to check whether the given number is prime or not
18.   Explain the functioning of lapply() and tapply() in a R program with one example
19.   What is variable scope?
20.   Distinguish between max( ) and pmax( ) functions.
221.   R pmax Function
pmax() function returns the parallel maxima vector of multiple vectors or matrix.
pmax(..., na.rm = FALSE)
...: Numeric or character arguments
na.rm: whether missing values should be removed
> x <- c(3, 26, 122, 6)
> y <- c(43,2,54,8)
> z <- c(9,32,1,9)
> pmax(x,y,z)
[1]  43  32 122   9

222.   Explain about quote( ) function.


23.   Justify the following: “R functions are first-class objects”.