Question
Asked @
Answers
Views
select
write the function. if all the character in string B appear in
string A, return true, otherwise return false.
Google
10
2597
How do you sort a Linked List (singly connected) in O(n)
please mail to pawan.10k@gmail.com if u can find an
anser...i m desperate to knw...
Oracle
3
3553
"c sharp" code for factorial using static variables
5
2653
Write a sql query to find n'th maximum in the database
table.
Oracle
3
1763
Algorithm in O(2n)
Presently we can solve in our hypothetical machine problem
instances of size 100 in 1 minute using algorithm A, which
is a O(2n). We would like to solve instances of size 200 in
1 minute using algorithm A on a new machine.
What is the speed of the new machine should be?
Qatar-University
2
473
Faster Computers
Suppose you have a computer that requires 1 minute to solve
problem instances of size 1000. What instance sizes can be
run in 1 minute if you buy a new computer that runs 1000
times faster than the old one, assuming the following time
complexities T(n) for our algorithm?
(a) T(n) = O(n).
(b) T(n) = O(n3).
(c) T(n) = O(10n).
Qatar-University
1
515
Teta-Omeg-Big-Oh
Show that f(n) = n2 + 3n3 is ;(n3).
Qatar-University
0
251
Min-Max
Write an algorithm that finds both the smallest and
largest numbers in a list of n numbers and with complexity
T(n) is at most about (1.5)n comparisons.
Qatar-University
5
2062
Min-Max
Write an algorithm that finds both the smallest and largest
numbers in a list of n numbers and calculate its complexity
T(n).
Qatar-University
1
361
Subsets
Write an algorithm that prints out all the subsets of 3
elements of a set of n elements. The elements of the set are
stored in a list that is the input to the algorithm. (Since
it is a set, you may assume all elements in the list are
distinct.)
Qatar-University
1
446
Complexity T(n)
Write a linear-time algorithm that sorts n distinct
integers, each of which is between 1 and 500.
Hint: Use a 500-element array. (Linear-time means your
algorithm runs in time c*n + b, where c and b are any
constants that do not depend on n.
For example, your algorithm can run in time n, or time 2n +
1, or time 5n + 10, or time 100n + 6, but not time c*n*n =
c*n?.)
Qatar-University
1
479
Complexity T(n)
What is the time complexity T(n) of the following portions
of code? For simplicity, you may assume that n is a power of
2. That is, n = 2k for some positive integer k.
a) ?
for (i = 1; i <= n; i++)
{
j = n; cout << i << ? ? j << ? ? << endl;
}
b) ?
for (i = 0; i <= n; i += 2)
{
j = n; cout << i << ? ? j << ? ? << endl;
}
c) ?
for (i = n; i >= 1; i = i/2)
{
j = n; cout << i << ? ? j << ? ? << endl;
}
d)
for (i = 1; i <= n; i++)
{ j = n;
while (j >= 0)
{ cout << i << ? ? j << ? ? << endl;
j = j - 2;
}
}
Qatar-University
0
164
Performance
Algorithm A performs 10n2 basic operations and algorithm B
performs 300 lg n basic operations. For what value of n does
algorithm B start to show its better performance?
Qatar-University
0
324
Show by induction that 2n > n2, for all n > 4.
Qatar-University
2
568
Coin Problem
You are given 9 gold coins that look identical. One is
counterfeit and weighs a bit greater than the others, but
the difference is very small that only a balance scale can
tell it from the real one. You have a balance scale that
costs 25 USD per weighing.
Give an algorithm that finds the counterfeit coin with as
little weighting as possible. Of primary importance is that
your algorithm is correct; of secondary importance is that
your algorithm truly uses the minimum number of weightings
possible.
HINT: THE BEST ALGORITHM USES ONLY 2 WEIGHINGS!!!
Qatar-University
1
1168
E-Mail New Answers
Answer Selected Questions
Prev 1 ... 4 ... 7 ... 10 ... 13 ... 16 ... 19 ... 22 24 [25] 26 ... 28 ... 31 Next
Un-Answered Questions
Question
Views
Asked at
Select
how to display after one month adding today's sysdatedate
in jsp?
234
Code for Two Classes for Doing Gzip in Memory?
237
plzzzzzzzzz xplain this code
import java.awt.*;
import java.awt.event.*;
import java.awt.MenuItem.*;
import java.sql.*;
import sun.jdbc.odbc.*;
import java.io.*;
public class ShopDelivery extends Frame implements
ActionListener
{
Label l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13;
Button exit,save,next,top,prev,botm,ad,show;
TextField
txtCMemoNo,txtConsNo,txtCMemoDt,txtConsName,txtAddr1,txtPhNo
,txtBookDtold,txtPrintDt,txtOldCMemNo,txtOldDlryDt,adr2,adr3
,tot,stnry,rmrk;
String ConsName;
String Addr1;
public static void main(String sr[])
{
new ShopDelivery().setVisible(true);
}
public ShopDelivery()
{
super("Shop Delivery");
Statement stmt;
ResultSet rs;
//PreparedStatement pst;
Connection con;
try
{
Class.forName
("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:Agency");
if (con!=null);
System.out.println
("connected");
stmt =con.createStatement
();
}
catch(Exception e1)
{
System.out.println
(e1);
}
setSize(1280,800);
setBackground(Color.CYAN);
setLayout(null);
l1=new Label("Cashmemo No");
l1.setBounds(260,60,90,30);
l1.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l1.setAlignment(Label.CENTER);
add(l1);
l2=new Label("CONSMR NO");
l2.setBounds(30,60,90,30);
l2.setFont(new Font("TimesRoman",Font.PLAIN,15));
l2.setAlignment(Label.CENTER);
add(l2);
l3=new Label("Book DATE");
l3.setBounds(520,60,90,30);
l3.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l3.setAlignment(Label.CENTER);
add(l3);
l4=new Label("NAME");
l4.setBounds(30,150,45,30);
l4.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l4.setAlignment(Label.CENTER);
add(l4);
l5=new Label("ADRS");
l5.setBounds(30,220,45,30);
l5.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l5.setAlignment(Label.CENTER);
add(l5);
l6=new Label("PH NO");
l6.setBounds(500,150,45,30);
l6.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l6.setAlignment(Label.CENTER);
add(l6);
l7=new Label("OldBkDt");
l7.setBounds(30,390,55,30);
l7.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l7.setAlignment(Label.CENTER);
add(l7);
l8=new Label("Print Date");
l8.setBounds(320,390,65,30);
l8.setFont(new Font("TimesRoman",Font.PLAIN,15));
l8.setAlignment(Label.CENTER);
add(l8);
l9=new Label("CMemo No");
l9.setBounds(700,390,65,30);
l9.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l9.setAlignment(Label.CENTER);
add(l9);
l10=new Label("Del Date");
l10.setBounds(550,390,55,30);
l10.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l10.setAlignment(Label.CENTER);
add(l10);
l13=new Label("REMARKS");
l13.setBounds
(30,630,85,30);
l13.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l13.setAlignment
(Label.CENTER);
add(l13);
txtCMemoNo=new TextField();
txtCMemoNo.setBounds(375,60,80,30);
txtCMemoNo.setBackground(Color.white);
add(txtCMemoNo);
txtConsNo=new TextField();
txtConsNo.setBounds(130,60,80,30);
txtConsNo.setBackground(Color.white);
add(txtConsNo);
txtCMemoDt=new TextField();
txtCMemoDt.setBounds(635,60,80,30);
txtCMemoDt.setBackground(Color.white);
add(txtCMemoDt);
txtConsName=new TextField();
txtConsName.setBounds(100,150,200,30);
txtConsName.setBackground(Color.white);
add(txtConsName);
txtAddr1=new TextField();
txtAddr1.setBounds(100,220,350,30);
txtAddr1.setBackground(Color.white);
add(txtAddr1);
adr2=new TextField();
adr2.setBounds(100,250,350,30);
adr2.setBackground(Color.white);
add(adr2);
adr3=new TextField();
adr3.setBounds(100,280,350,30);
adr3.setBackground(Color.white);
add(adr3);
txtPhNo=new TextField();
txtPhNo.setBounds(570,150,150,30);
txtPhNo.setBackground(Color.white);
add(txtPhNo);
txtBookDtold=new TextField();
txtBookDtold.setBounds(30,440,60,30);
txtBookDtold.setBackground(Color.white);
add(txtBookDtold);
txtPrintDt=new TextField();
txtPrintDt.setBounds(320,440,60,30);
txtPrintDt.setBackground(Color.white);
add(txtPrintDt);
txtOldCMemNo=new TextField();
txtOldCMemNo.setBounds(700,440,60,30);
txtOldCMemNo.setBackground(Color.white);
add(txtOldCMemNo);
txtOldDlryDt=new TextField();
txtOldDlryDt.setBounds(550,440,60,30);
txtOldDlryDt.setBackground(Color.white);
add(txtOldDlryDt);
rmrk=new TextField();
rmrk.setBounds(140,630,600,30);
rmrk.setBackground(Color.white);
add(rmrk);
exit=new Button("EXIT");
exit.setBackground(Color.orange);
exit.setBounds(760,700,40,40);
exit.addActionListener(this);
add(exit);
save=new Button("SAVE");
save.setBackground(Color.orange);
save.setBounds(715,700,40,40);
save.addActionListener(this);
add(save);
next=new Button("NEXT");
next.setBackground(Color.orange);
next.setBounds(90,700,40,40);
next.addActionListener(this);
add(next);
top=new Button("TOP");
top.setBackground(Color.orange);
top.setBounds(0,700,40,40);
top.addActionListener(this);
add(top);
prev=new Button("PREV");
prev.setBackground(Color.orange);
prev.setBounds(45,700,40,40);
prev.addActionListener(this);
add(prev);
botm=new Button("BOTM");
botm.setBackground
(Color.orange);
botm.setBounds
(135,700,40,40);
botm.addActionListener
(this);
add(botm);
ad=new Button("ADD");
ad.setBackground
(Color.orange);
ad.setBounds
(300,700,40,40);
ad.addActionListener
(this);
add(ad);
show=new Button("SHOW");
show.setBackground
(Color.orange);
show.setBounds
(345,700,40,40);
show.addActionListener
(this);
add(show);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==exit)
{
this.dispose();
System.exit(0);
}
/*if(e.getSource()==save)
{
try
{
Connection
con=DriverManager.getConnection("jdbc:odbc:Agency");
PreparedStatement pst=con.prepareStatement("INSERT INTO
NewCon values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
pst.setInt
(1,Integer.parseInt(txtConsNo.getText()));
pst.setInt
(2,Integer.parseInt(txtCMemoNo.getText()));
pst.setString
(3,txtCMemoDt.getText());
pst.setString
(4,txtConsName.getText());
pst.setInt(5,Integer.parseInt
(txtPhNo.getText()));
pst.setString(6,txtAddr1.getText());
pst.setString(7,adr2.getText());
pst.setString(8,adr3.getText());
pst.setInt(9,Integer.parseInt
(txtBookDtold.getText()));
pst.setInt(10,Integer.parseInt
(txtPrintDt.getText()));
pst.setInt(11,Integer.parseInt
(txtOldDlryDt.getText()));
pst.setInt(12,Integer.parseInt
(txtCMemoNo.getText()));
pst.setInt(13,Integer.parseInt
(tot.getText()));
pst.setInt(14,Integer.parseInt
(stnry.getText()));
pst.setString(15,rmrk.getText());
pst.executeUpdate
();
con.close();
}
catch(Exception e2)
{System.out.println(e2);}
//cs(txtConsName.getText
(),txtAddr1.getText());
}*/
if(e.getSource()==ad)
{
try
{
txtCMemoNo.setText("");
txtCMemoDt.setText("");
txtConsName.setText("");
txtAddr1.setText("");
txtPhNo.setText("");
txtBookDtold.setText("");
txtPrintDt.setText("");
//txtCMemoNo.setText("");
txtOldDlryDt.setText("");
adr2.setText("");
adr3.setText("");
tot.setText("");
//stnry.setText("");
//rmrk.setText("");
Connection
con1=DriverManager.getConnection("jdbc:odbc:Agency");
Statement
stmt1=con1.createStatement();
ResultSet
rs1=stmt1.executeQuery("SELECT Max(Cons_No) FROM NewCon");
int nextcono = rs1.getInt
("Cons_No");
System.out.println
(nextcono);
nextcono=nextcono+1;
txtConsNo.setText
("nextcono");
con1.close();
}
catch(Exception e4){}
}
}
}
140
How to pass multiple rows from one gridview to another
gridview after clicking the checkbox.
524
Satyam
Code for Searching for Multiple Matches with the
MatchCollection Class?
344
TCS
Code for Communicating over Sockets?
237
How to use Client-side Script to Focus Controls in ASP.NET?
188
How to export 2 datatables of a single dataset to 2
different worksheets of a single MSExcel file ?
235
Eastcom-Systems
. Remove all the blank spaces between
character.Matrix is of 10* 10.
eg: INPUT
------------------------------------
| N | A | | V | |T
-------------------------------------
| |G | U | |P |
--------------------------------------
|T | | | A | |
------------------------------------
OUTPUT:
------------------------------------
| N | A | V | T | |
-------------------------------------
|G |U | P | | |
--------------------------------------
|T | A | | | |
------------------------------------
59
plzzzzzzzzz xplain this code
import java.awt.*;
import java.awt.event.*;
//import java.awt.MenuItem.*;
public class MenuForm extends Frame implements
ActionListener
{
MenuBar mb=new MenuBar();
Menu m1=new Menu("Master");
Menu m2 =new Menu("Transactions");
Menu m3=new Menu("Queries");
Menu m4=new Menu("Reports");
Menu m5=new Menu("Daily/Weekly");
Menu m6=new Menu("Housekeeping");
Menu m7=new Menu("About");
Menu m8=new Menu("Utilities/Tools");
Menu m9=new Menu("exit");
MenuItem m11=new MenuItem("consumer master");
MenuItem m12=new MenuItem("");
MenuItem m13=new MenuItem("");
MenuItem m21=new MenuItem("New Connection");
MenuItem m22=new MenuItem("Refill Booking");
MenuItem m23=new MenuItem("Shop Delivery");
MenuItem m51=new MenuItem("Mrk Dlry");
MenuItem m91=new MenuItem("Quit");
/*MenuItem m131=new MenuItem(" ");
MenuItem m132=new MenuItem(" ");
MenuItem m134=new MenuItem(" ");*/
Font f=new Font("TimesRoman",Font.BOLD,16);
Frame f1;
public static void main(String args[])
{
new MenuForm().setVisible(true);
}
public MenuForm()
{
super("Gas Agency Main Menu");
setSize(1280,800);
setBackground(Color.lightGray);
setLayout(null);
setMenuBar(mb);
/*m1.setFont(new Font("TimesRoman",
Font.BOLD,16));
m2.setFont(new Font("TimesRoman",
Font.BOLD,16));
m3.setFont(new Font("TimesRoman",
Font.BOLD,16));*/
mb.add(m1);
mb.add(m2);
mb.add(m3);
mb.add(m4);
mb.add(m5);
mb.add(m6);
mb.add(m7);
mb.add(m8);
mb.add(m9);
m1.add(m11);
m1.add(m12);
m1.add(m13);
m2.add(m21);
m2.add(m22);
m2.add(m23);
m5.add(m51);
m9.add(m91);
//m3.add(m31);
/*m13.setEnabled(false);
m13.add(m131);
m13.add(m132);
m13.add(m133);
m13.add(m134);
m13.add(m135);*/
setVisible(true);
/*m11.addActionListener(this);
m12.addActionListener(this);
m13.addActionListener(this);
m2.addActionListener(this);
m3.addActionListener(this);*/
m21.addActionListener(this);
m22.addActionListener(this);
m23.addActionListener(this);
/*m31.addActionListener(this);
m131.addActionListener(this);
m132.addActionListener(this);
m133.addActionListener(this);
m134.addActionListener(this);
m135.addActionListener(this);*/
m51.addActionListener(this);
m91.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
/*if(e.getSource()==m11)
{
}
if(e.getSource()==m12)
{
}
if( (e.getSource()==m131) || (e.getSource()
==m132) || (e.getSource()==m133) || (e.getSource()==m134)
|| (e.getSource()==m135) )
{
}*/
if(e.getSource()==m21)
{
NewConnection nc=new NewConnection
();
nc.setVisible(true);
this.dispose();
}
if(e.getSource()==m22)
{
RefillBooking rb=new RefillBooking
();
rb.setVisible(true);
this.dispose();
}
if(e.getSource()==m23)
{
ShopDelivery sd=new ShopDelivery();
sd.setVisible(true);
this.dispose();
}
if(e.getSource()==m51)
{
MarkDelivery
mrk=new MarkDelivery();
mrk.setVisible
(true);
this.dispose();
}
if(e.getSource()==m91)
{
this.dispose();
System.exit(0);
}
}
}
153
Implement a t9 mobile dictionary.
(Give code with explanation )
511
Yahoo
can any body give me answer to this question please?
please give me code in cl with the folling specifications.
1.Accept 2 parameters-date and date type
2.If date type is J then convert date to *MDY format
3.If date type is M convert date to *JUL format
4. Send a program message with the value of converted date?
Please give me the answer.Because im practicing in my
house.Im taking trining on AS/400.
214
Write a program to implement the motion of a bouncing ball
using a downward gravitational force and a ground-plane
friction force. Initially the ball is to be projected in to
space with a given velocity vector
508
program to find the magic square using array
1044
Can you send Code for Run Length Encoding Of BMP Image in C
Language in linux(i.e Compression and Decompression) ?
433
Honeywell
A suduco given & u hv 2 check if it is incomplete(blanks
left),or correct or incorrect
42
I am trying to pass the string firstName from a Servlet
called SampleServet. I am running this on eclipse and it
tells me that "the value for annotation attribute must be a
constant expression. I don't understand why it is giving me
this error.
@PersonAnnotation(name = SampleServlet.firstName)
public class AnnotationClass{
121
Coding for .NET Delegates?
223
plzzzzzzzzz xplain this code
import java.awt.*;
import java.util.Date;
import java.awt.event.*;
import java.awt.MenuItem.*;
import java.sql.*;
import sun.jdbc.odbc.*;
import java.io.*;
public class NewConnection extends Frame implements
ActionListener
{
Label l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13;
Button exit,save,bnext,top,prev,botm,ad,edit;
TextField
txtSvNo,txtConsNo,txtSvDt,txtConsName,txtAddr1,txtPhNo,txtCy
lQty,txtCylDep,txtRegDep,txtRegQty,adr2,adr3,tot,stnry,rmrk;
Date date=new Date();
String ConsName;
String Addr1;
public static void main(String sr[])
{
new NewConnection().setVisible(true);
}
public NewConnection()
{
super("New Connection");
Statement stmt;
ResultSet rs;
//PreparedStatement pst;
Connection con;
try
{
Class.forName
("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:Agency");
if (con!=null);
System.out.println
("connected");
stmt =con.createStatement
();
}
catch(Exception e1)
{
System.out.println
(e1);
}
setSize(1280,800);
setBackground(Color.lightGray);
setLayout(null);
l1=new Label("SV NO");
l1.setBounds(260,60,90,30);
l1.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l1.setAlignment(Label.CENTER);
add(l1);
l2=new Label("CONSMR NO");
l2.setBounds(30,60,90,30);
l2.setFont(new Font("TimesRoman",Font.PLAIN,15));
l2.setAlignment(Label.CENTER);
add(l2);
l3=new Label("SV DATE");
l3.setBounds(520,60,90,30);
l3.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l3.setAlignment(Label.CENTER);
add(l3);
l4=new Label("NAME");
l4.setBounds(30,150,45,30);
l4.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l4.setAlignment(Label.CENTER);
add(l4);
l5=new Label("ADRS");
l5.setBounds(30,220,45,30);
l5.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l5.setAlignment(Label.CENTER);
add(l5);
l6=new Label("PH NO");
l6.setBounds(500,150,45,30);
l6.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l6.setAlignment(Label.CENTER);
add(l6);
l7=new Label("CYLDR");
l7.setBounds(30,390,55,30);
l7.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l7.setAlignment(Label.CENTER);
add(l7);
l8=new Label("DEPOSIT");
l8.setBounds(320,390,65,30);
l8.setFont(new Font("TimesRoman",Font.PLAIN,15));
l8.setAlignment(Label.CENTER);
add(l8);
l9=new Label("DEPOSIT");
l9.setBounds(320,440,65,30);
l9.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l9.setAlignment(Label.CENTER);
add(l9);
l10=new Label("RGLTR");
l10.setBounds(30,440,55,30);
l10.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l10.setAlignment(Label.CENTER);
add(l10);
l11=new Label("TOTAL");
l11.setBounds(320,480,55,30);
l11.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l11.setAlignment(Label.CENTER);
add(l11);
l12=new Label("Cur.Statn.NO.");
l12.setBounds(290,550,85,30);
l12.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l12.setAlignment(Label.CENTER);
add(l12);
l13=new Label("REMARKS");
l13.setBounds
(30,630,85,30);
l13.setFont(new Font
("TimesRoman",Font.PLAIN,15));
l13.setAlignment
(Label.CENTER);
add(l13);
txtSvNo=new TextField();
txtSvNo.setBounds(375,60,80,30);
txtSvNo.setBackground(Color.white);
add(txtSvNo);
txtConsNo=new TextField();
txtConsNo.setBounds(130,60,80,30);
txtConsNo.setBackground(Color.white);
add(txtConsNo);
txtSvDt=new TextField();
txtSvDt.setBounds(635,60,80,30);
txtSvDt.setBackground(Color.white);
add(txtSvDt);
txtConsName=new TextField();
txtConsName.setBounds(100,150,200,30);
txtConsName.setBackground(Color.white);
add(txtConsName);
txtAddr1=new TextField();
txtAddr1.setBounds(100,220,350,30);
txtAddr1.setBackground(Color.white);
add(txtAddr1);
adr2=new TextField();
adr2.setBounds(100,250,350,30);
adr2.setBackground(Color.white);
add(adr2);
adr3=new TextField();
adr3.setBounds(100,280,350,30);
adr3.setBackground(Color.white);
add(adr3);
txtPhNo=new TextField();
txtPhNo.setBounds(570,150,150,30);
txtPhNo.setBackground(Color.white);
add(txtPhNo);
txtCylQty=new TextField();
txtCylQty.setBounds(100,390,60,30);
txtCylQty.setBackground(Color.white);
add(txtCylQty);
txtCylDep=new TextField();
txtCylDep.setBounds(410,390,60,30);
txtCylDep.setBackground(Color.white);
add(txtCylDep);
txtRegDep=new TextField();
txtRegDep.setBounds(410,440,60,30);
txtRegDep.setBackground(Color.white);
add(txtRegDep);
txtRegQty=new TextField();
txtRegQty.setBounds(100,440,60,30);
txtRegQty.setBackground(Color.white);
add(txtRegQty);
tot=new TextField();
tot.setBounds(410,490,60,30);
tot.setBackground(Color.white);
add(tot);
stnry=new TextField();
stnry.setBounds(410,550,60,30);
stnry.setBackground(Color.white);
add(stnry);
rmrk=new TextField();
rmrk.setBounds(140,630,600,30);
rmrk.setBackground(Color.white);
add(rmrk);
exit=new Button("EXIT");
exit.setBackground(Color.orange);
exit.setBounds(760,700,40,40);
exit.addActionListener(this);
add(exit);
save=new Button("SAVE");
save.setBackground(Color.orange);
save.setBounds(715,700,40,40);
save.addActionListener(this);
add(save);
bnext=new Button("NEXT");
bnext.setBackground(Color.orange);
bnext.setBounds(90,700,40,40);
bnext.addActionListener(this);
add(bnext);
top=new Button("TOP");
top.setBackground(Color.orange);
top.setBounds(0,700,40,40);
top.addActionListener(this);
add(top);
prev=new Button("PREV");
prev.setBackground(Color.orange);
prev.setBounds(45,700,40,40);
prev.addActionListener(this);
add(prev);
botm=new Button("BOTM");
botm.setBackground
(Color.orange);
botm.setBounds
(135,700,40,40);
botm.addActionListener
(this);
add(botm);
ad=new Button("ADD");
ad.setBackground
(Color.orange);
ad.setBounds
(300,700,40,40);
ad.addActionListener
(this);
add(ad);
edit=new Button("EDIT");
edit.setBackground
(Color.orange);
edit.setBounds
(345,700,40,40);
edit.addActionListener
(this);
add(edit);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==exit)
{
this.dispose();
System.exit(0);
}
if(e.getSource()==save)
{
try
{
Connection
con=DriverManager.getConnection("jdbc:odbc:Agency");
PreparedStatement pst=con.prepareStatement("INSERT INTO
NewCon values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
pst.setInt
(1,Integer.parseInt(txtConsNo.getText()));
pst.setInt
(2,Integer.parseInt(txtSvNo.getText()));
pst.setString
(3,txtSvDt.getText());
pst.setString
(4,txtConsName.getText());
pst.setInt(5,Integer.parseInt
(txtPhNo.getText()));
pst.setString(6,txtAddr1.getText());
pst.setString(7,adr2.getText());
pst.setString(8,adr3.getText());
pst.setInt(9,Integer.parseInt
(txtCylQty.getText()));
pst.setInt(10,Integer.parseInt
(txtCylDep.getText()));
pst.setInt(11,Integer.parseInt
(txtRegQty.getText()));
pst.setInt(12,Integer.parseInt
(txtRegDep.getText()));
pst.setInt(13,Integer.parseInt
(tot.getText()));
pst.setInt(14,Integer.parseInt
(stnry.getText()));
pst.setString(15,rmrk.getText());
pst.executeUpdate
();
con.close();
}
catch(Exception e2)
{System.out.println(e2);}
}
if(e.getSource()==ad)
{
int newcono=60000,newsvno=10000;
System.out.println("entered if
body");
try
{
System.out.println("entered
the try:");
Connection
con1=DriverManager.getConnection("jdbc:odbc:Agency");
Statement
stmt1=con1.createStatement();
ResultSet
rs1=stmt1.executeQuery("SELECT Cons_No,Sv_No FROM NewCon ");
while(rs1.next())
{
//System.out.println(rs1.getInt("Cons_No"));
txtConsNo.setText(""+rs1.getInt(1));
txtSvNo.setText(""+rs1.getInt(2));
//newcono=rs1.getInt("Cons_No");
}
//rs1.last();
newcono=Integer.parseInt(txtConsNo.getText
());
newsvno=Integer.parseInt(txtSvNo.getText
());
//newcono=rs1.getInt("Cons_No");
System.out.println(newcono);
newcono=newcono+1;
newsvno=newsvno+1;
txtConsNo.setText
(""+newcono);
txtSvNo.setText(""+newsvno);
txtSvDt.setText(""+ date);
txtConsName.setText("");
txtAddr1.setText("");
txtPhNo.setText("");
txtCylQty.setText("");
txtCylDep.setText("");
txtRegDep.setText("");
txtRegQty.setText("");
adr2.setText("");
adr3.setText("");
tot.setText("");
stnry.setText("");
rmrk.setText("");
con1.close();
}
catch(Exception e4){System.out.println
(e4);}
}
if(e.getSource()==bnext)
{
try{
Connection con2=DriverManager.getConnection
("jdbc:odbc:Agency");
Statement stmt2=con2.createStatement
();
ResultSet
rs2=stmt2.executeQuery("SELECT * FROM NewCon ");
rs2.next();
{
txtConsNo.setText(rs2.getInt(1)+"");
txtSvNo.setText
(rs2.getInt(2)+"");
txtSvDt.setText
(rs2.getString(3)+"");
txtConsName.setText
(rs2.getString(4)+"");
txtPhNo.setText
(rs2.getInt(5)+"");
txtAddr1.setText(rs2.getString(6)+"");
adr2.setText
(rs2.getString("Address2")+"");
adr3.setText
(rs2.getString("Address3")+"");
txtCylQty.setText
(rs2.getInt(9)+"");
txtCylDep.setText
(rs2.getInt(10)+"");
txtRegDep.setText
(rs2.getInt(11)+"");
txtRegQty.setText
(rs2.getInt(12)+"");
tot.setText(rs2.getInt
(13)+"");
stnry.setText(rs2.getInt(14)
+"");
rmrk.setText(rs2.getString
(15)+"");
}
}
catch(Exception e5){}
}
}
}
169
what mean void creat_object?in public class
in this code
class A{
public:
int x;
A(){ cout << endl<< "Constructor A";}
~A(){ cout << endl<< "Destructor A, x is\t"<< x;}
};
void create_object();
void main()
{
A a;
a.x=10;
{
A c;
c.x=20;
}
create_object();
}
void create_object()
{
A b;
b.x=30;
}
33
E-Mail New Answers
Answer Selected Questions