Professional Documents
Culture Documents
SCHOOL
A PROGRAM FILE
ON
INFORMATICS PRACTICES
FOR
AISSCE 2018 EXAMINATION
[AS A PART OF THE INFORMATICS PRACTICES
COURSE (065)]
1
CERTIFICATE
This is to certify that the PROGRAM FILE is a bonafide work
2018 and has been carried out under my direct supervision and
guidance. This file or a similar file on the topic has not been
submitted for any other examination and does not form a part
………………………… ……………………………..
Signature of Student Signature of Teacher/Guide
……….…………………
Signature of Principal
Name: Dr. A.N SHARMA
Place: POWAYAN
DATE:
2
ACKNOWLEDGEMENT
I
undertook this Project work, as the part of my XII-Informatics
Practices course. I had tried to apply my best of knowledge and
experience, gained during the study and class work experience.
However, developing software system is generally a quite complex and
time-consuming process. It requires a systematic study, insight vision
and professional approach during the design and development.
Moreover, the developer always feels the need, the help and good
wishes of the people near you, who have considerable experience and
idea.
I also feel indebted to my friends for the valuable suggestions during the
project work.
VIKRAM CHAUDHARY
Class- XII-COM
INDEX
3
TITLE Page_no
2-Programs on IDE 20 to 38
3-Mysql Queries 39 to 49
4-JDBC 50 to 54
4
FOLLOWING PROGRAMS ARE BASED ON
JAVA CORE WHICH DOES NOT REQUIRE AN
IDE TO RUN .
PROGRAM-1
5
PROGRAM-2
6
7
PROGRAM-3
8
PROGRAM-4
9
PROGRAM-5
10
PROGRAM-6
11
12
PROGRAM-7
13
PROGRAM-8
14
15
PROGRAM-9
16
PROGRAM-10
17
18
19
IDE STANDS FOR INTEGRATED DATA
ENVIRONMENT,ANPROVIDES VARIOUS TOOLS SUCH
ASCOMPILING,LINKING,DEBUGGING,ETC.
THERE ARE MANY IDE’s SUCH AS ECLIPSE,NETBEANS AND
BLUE J.HERE WE HAVE USED NETBEANS IDE 6.5.1 TO
DEVELOPE OUR APPLICATIONS.
PROGRAM-1:- addition-
20
CODE:-
private void jButton1ActionPerformed (java.awt.event.ActionEvent
evt) {
int a=Integer.parseInt (t1.getText());
int b=Integer.parseInt (t2.getText ());
int c=a+b;
t3.setText (""+c);
}
private void jButton4ActionPerformed (java.awt.event.ActionEvent
evt) {
int a=Integer.parseInt (t1.getText ());
int b=Integer.parseInt (t2.getText ());
int c=a/b;
t3.setText (""+c);
}
21
private void jButton3ActionPerformed (java.awt.event.ActionEvent
evt) {
int a=Integer.parseInt (t1.getText ());
int b=Integer.parseInt (t2.getText ());
int c=a*b;
t3.setText (""+c);
}
22
CODE:-
private void jButton3ActionPerformed(java.awt.event.ActionEvent
evt) {
int fee=0,tot;
if (radcom.isSelected())
fee=2500;
else if (radart.isSelected())
fee=2000;
else if (radmed.isSelected())
fee=2900;
else if (radnon.isSelected())
fee=2800;
tot=fee;
jTextField3.setText(""+tot);
if(ch1.isSelected())
tot=tot+200;
jTextField3.setText(""+tot);
23
}
24
CODE:-
int p,r,t,i,a;
p=Integer.parseInt(t1.getText());
t=Integer.parseInt(t3.getText());
r=0;
if(r1.isSelected()){
if(t<1)r=10;
else if (t>=1 && t<=5) r=12;
else if (t>5) r=15;
if(r2.isSelected()){
if(t<=2)r=11;
else if(t>2 && t<=7) r=12
else if(t>7) r=15;
25
}
if (chk1.isSelected()){
r=r+2;
}
i=p*r*t/100;
t4.setText(""+i);
a=p+i;
t5.setText(""+a);
}
}
26
Code:-
private void jButton2ActionPerformed(java.awt.event.ActionEvent
evt) {
String v1=t1.getText();
int ga=Integer.parseInt(v1);
ga=ga+1;
t1.setText(""+ga);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent
evt) {
String v1=t2.getText ();
int ga=Integer.parseInt(v1);
ga=ga+1;
t2.setText(""+ga);
27
}
private void declresActionPerformed(java.awt.event.ActionEvent
evt) {
String v1=t1.getText();
int ga=Integer.parseInt(v1);
String v2=t2.getText();
int gb=Integer.parseInt(v2);
String res=(ga>gb? "Team A wins":(ga<gb)?"Team b win":"Draw"
);
r1.setText(res);
}
Program-5:-delete record-
28
code:-
String pd=new String(pwd1.getPassword());
if(pd.equals("007")){
this.setVisible(false);
new Details().setVisible(true);
}
else{
JOptionPane.showMessageDialog(null,"Invalid Password");
}
29
}
program-6:-hotel management-
Code-
int a,b,c,d,e,f;
a=Integer.parseInt(t1.getText());
b=Integer.parseInt(t2.getText());
c=Integer.parseInt(t3.getText());
d=Integer.parseInt(t4.getText());
e=Integer.parseInt(t5.getText());
30
f=Integer.parseInt(t6.getText());
if(one.isSelected()){
amt.setText("2000");
}
if(two.isSelected()){
amt.setText("4000");
}
if(single.isSelected()){
amt.setText("1000");
}
if(dou.isSelected()){
amt.setText("2000");
}
31
Code:-
int score=0;
if(chk1.isSelected()){
t3.setText(""+10);
score=score+10;
}
if(chk2.isSelected()){
t4.setText(""+10);
score=score+10;
}
if(chk3.isSelected()){
t5.setText(""+10);
score=score+10;
}
t6.setText(""+score);
clear:-
32
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
t6.setText("");
chk1.setSelected(false);
chk2.setSelected(false);
chk3.setSelected(false);
program:-8- 7 wonders-
Code:-
33
ta1.setText("");
t1.setIcon(new ImageIcon("E:\ravinder\220px-
Cristo_Redentor_-_Rio_de_Janeiro,_Brasil.jpg"));
ta1.append("Christ the Redeemer (Portuguese is an Art Deco.");
}
private void b1ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\index.jpg"));
ta1.append("Tajmahal was built by shahjhan in agra");
}
private void b2ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\ffvgm.jpg"));
ta1.append("Great wall of china is sistuated in China")
}
private void b3ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\wergter.jpg"));
ta1.append("Petra originally known to the Nabataeans as Raqmu,
is a historical and archaeological city in southern Jordan.");
}
private void b4ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\index.jpg"));
34
}
private void b5ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\images.jpg"));
ta1.append("The Great Pyramid of Giza is the oldest and largest
of the three pyramids in the Giza pyramid complex bordering what
is now El Giza.");
}
private void b7ActionPerformed(java.awt.event.ActionEvent evt) {
ta1.setText("");
t1.setIcon(new ImageIcon("E:\\ravinder\\index.jpg"));
ta1.append("Tajmahal was built by shahjhan in agra");
program:-9-simple interest-
35
Code:-
int p,r,t,i,a;
p=Integer.parseInt(t1.getText());
r=Integer.parseInt(t2.getText());
t=Integer.parseInt(t3.getText());
i=p*r*t/100;
t4.setText(""+i);
a=p+i;
t5.setText(""+a);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent
evt) {
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
36
t5.setText("");
0
}
Program:-10-marks calculator-
Code:-
int sum,phy,che,maths;
String n;
n=(String)t4.getText();
phy=Integer.parseInt(t1.getText());
che=Integer.parseInt(t2.getText());
maths=Integer.parseInt(t3.getText());
sum=phy+che+maths;
t.append("name:"+n+'\n');
t.append("marks:"+sum+'\n');
if(sum>=180&&sum<=300){
t.append("eligible");
37
}
else{
t.append("not eligible");
}
38
MYSQL IS AN RDBMS WHICH IS OPEN SOURCE.BY THESE
QUERIES WE WANT TO SHOW HOW THE DATABASE
QUERIES ARE HANDLED IN MYSQL.
QUERY-1
39
QUERY-2
40
QUERY-3
41
QUERY-4
42
QUERY-5
43
QUERY-6
44
QUERY-7
45
QUERY-8
46
QUERY-9
47
QUERY-10
48
JDBC DOES THE FOLLOWING TASK FROM WITHIN A JAVA
APPLICATION CODE.
49
1-ESTABLISH A CONNECTION WITH A DATABASE.
2-SEND SQL STATEMENTS TO DATABASE SERVER.
3-PROCESS THE RESULT OBTAINED.
PROGRAM-1
CODE-
import java.sql.*;
public class DemoJdbc {
50
public static void main(String[] args)
{
try
{
String Query="select * from student where rollno=2";
//Class.forName("com.mysql.jdbc.Driver");
//1.Get a Connection to database
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3
306/Demo","root","tiger");
//2. Create a statement
Statement st=con.createStatement();
//3. Execute a Query
ResultSet rs=st.executeQuery(Query);
//4. Process the Resultset
rs.next();
String name=rs.getString(2);
System.out.println(name);
con.close();
}
catch(Exception e)
{
System.out.println("ERROR"+e);
}
51
PROGRAM-2
CODE-
package practicaljdbc;
import java.sql.*;
class practicaljdbc {
52
public static void main(String[] args)
{
try
{
String Query="select * from student where no=2";
//Class.forName("com.mysql.jdbc.Driver");
//1.Get a Connection to database
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3
306/employee","root","tiger");
//2. Create a statement
Statement st=con.createStatement();
//3. Execute a Query
ResultSet rs=st.executeQuery(Query);
//4. Process the Resultset
while( rs.next())
{
String name=rs.getString(1)+" "+rs.getString(2)+"
"+rs.getString(3);
System.out.println(name);
//con.close();
}
con.close();
}
catch(Exception e)
{
System.out.println("ERROR"+e);
}
53
}
}
54
55