import [Link].
*;
import [Link].*;
public class data {
static void myLine(){
for (int i=1;i<=80;i++)
[Link]("*");
[Link]();
public static void main(String[] args) {
Connection con;
Statement st;
BufferedReader bin;
ResultSet rs;
ResultSetMetaData rm;
String sno1, sname1, sco1;
int ch, nof;
try
[Link]("[Link]");
con = [Link]("jdbc:odbc:mydsn");
st = [Link]();
bin = new BufferedReader(new InputStreamReader([Link]));
while(true){
[Link]("Choose Option");
[Link]("1. Select");
[Link]("2. Insert");
[Link]("3. Update");
[Link]("4. Delete");
[Link]("0. Exit");
ch = [Link]([Link]());
if (ch==1)
rs = [Link]("select * from ta");
rm = [Link]();
nof = [Link]();
myLine();
for(int i=1; i<=nof; i++)
[Link]([Link](i)+"\t\t");
[Link]();
myLine();
while([Link]())
for(int i=1; i<=nof; i++)
{
[Link]([Link](i) +"\t\t");
[Link]();
myLine();
else if(ch==2)
do
[Link]("Enter Student No :");
sno1 = [Link]();
[Link]("Enter Student Name");
sname1 = [Link]();
[Link]("Enter Course");
sco1 = [Link]();
[Link]("insert into ta values("+sno1+",'"+sname1+"','"+sco1+"')");
[Link]("1 Record inserted");
[Link]("Continue ? [y/n]");
sno1 = [Link]();
}while([Link]("y"));
else if(ch==3)
{
[Link]("Enter SNo. to Edit :");
sno1 = [Link]();
[Link]("Enter Name");
sname1 = [Link]();
[Link]("Enter Course");
sco1 = [Link]();
[Link]("update ta set sname='"+sname1+"', sco='"+sco1+"' where sno ="+sno1);
[Link]("1 Record Updated");
else if(ch==4)
[Link]("Enter SNo. to Delete :");
sno1 = [Link]();
[Link]("delete from ta where sno ="+sno1);
[Link]("Record Deleted");
else if(ch==0)
[Link]();
[Link]();
[Link](0);
}
}
catch(Exception e)
[Link]("Error :"+[Link]());
//program 2
/*Java Program to Demonstrate a Basic Calculator using Applet*/
import [Link].*;
import [Link].*;
import [Link].*;
public class cal extends Applet implements ActionListener
TextField inp;
//Function to add features to the frame
public void init()
setBackground([Link]);
setLayout(null);
int i;
inp = new TextField();
[Link](150,100,270,50);
[Link](inp);
Button button[] = new Button[10];
for(i=0;i<10;i++)
button[i] = new Button([Link](9-i));
button[i].setBounds(150+((i%3)*50),150+((i/3)*50),50,50);
[Link](button[i]);
button[i].addActionListener(this);
Button dec=new Button(".");
[Link](200,300,50,50);
[Link](dec);
[Link](this);
Button clr=new Button("C");
[Link](250,300,50,50);
[Link](clr);
[Link](this);
Button operator[] = new Button[5];
operator[0]=new Button("/");
operator[1]=new Button("*");
operator[2]=new Button("-");
operator[3]=new Button("+");
operator[4]=new Button("=");
for(i=0;i<4;i++)
operator[i].setBounds(300,150+(i*50),50,50);
[Link](operator[i]);
operator[i].addActionListener(this);
operator[4].setBounds(350,300,70,50);
[Link](operator[4]);
operator[4].addActionListener(this);
String num1="";
String op="";
String num2="";
//Function to calculate the expression
public void actionPerformed(ActionEvent e)
String button = [Link]();
char ch = [Link](0);
if(ch>='0' && ch<='9'|| ch=='.')
if ()
num2 = num2 + button;
else
num1 = num1 + button;
[Link](num1+op+num2);
}
else if(ch=='C')
num1 = op = num2 = "";
[Link]("");
else if (ch =='=')
if( && )
double temp;
double n1=[Link](num1);
double n2=[Link](num2);
if(n2==0 && [Link]("/"))
[Link](num1+op+num2+" = Zero Division Error");
num1 = op = num2 = "";
else
if ([Link]("+"))
temp = n1 + n2;
else if ([Link]("-"))
temp = n1 - n2;
else if ([Link]("/"))
temp = n1/n2;
else
temp = n1*n2;
[Link](num1+op+num2+" = "+temp);
num1 = [Link](temp);
op = num2 = "";
else
num1 = op = num2 = "";
[Link]("");
else
if ([Link]("") || [Link](""))
op = button;
else
double temp;
double n1=[Link](num1);
double n2=[Link](num2);
if(n2==0 && [Link]("/"))
{
[Link](num1+op+num2+" = Zero Division Error");
num1 = op = num2 = "";
else
if ([Link]("+"))
temp = n1 + n2;
else if ([Link]("-"))
temp = n1 - n2;
else if ([Link]("/"))
temp = n1/n2;
else
temp = n1*n2;
num1 = [Link](temp);
op = button;
num2 = "";
[Link](num1+op+num2);
/*
<applet code = [Link] width=600 height=600>
</applet>
*/