Informatics Practces: Name-Himanshu Saini Class-Xii - H Roll No. 17
Informatics Practces: Name-Himanshu Saini Class-Xii - H Roll No. 17
PRACTCES
NAME-HIMANSHU SAINI
CLASS-XII – H
ROLL NO. 17
INDEX
JAVA
1. Screenshot 01
2. Screenshot 02
3. Screenshot 03
4. Screenshot 04
5. Screenshot 05
6. Screenshot 06
7. Screenshot 07
8. Screenshot 08
9. Screenshot 09
10. Screenshot 10
11. Screenshot 11
12. Screenshot 12
13. Screenshot 13
14. Screenshot 14
15. Screenshot 15
HTML
1. Computer Virus
2. My Registration
Page
MYSQL
1. Q1.
2. Q2.
3. Q3.
4. Q4.
5. Q5.
6. Q6.
NETBEANS
Q1:
CODING
(+)
lbl.setText("+");
double num1
=Double.parseDouble(txt1.getText());
double
num2=Double.parseDouble(txt2.getText());
double num3=num1+num2;
txt3.setText(""+num3);
txt3.setEditable(false);
(-)
lbl.setText("-");
double
num1=Double.parseDouble(txt1.getText());
double
num2=Double.parseDouble(txt2.getText());
double num3=num1-num2;
txt3.setText(""+num3);
(*)
lbl.setText("*");
double
num1=Double.parseDouble(txt1.getText());
double
num2=Double.parseDouble(txt2.getText());
double num3=num1*num2;
txt3.setText(""+num3);
(/)
lbl.setText("/");
double
num1=Double.parseDouble(txt1.getText());
double
num2=Double.parseDouble(txt2.getText());
double num3=num1/num2;
txt3.setText(""+num3);
(%)
lbl.setText("%");
double
num1=Double.parseDouble(txt1.getText());
double
num2=Double.parseDouble(txt2.getText());
double num3=num1%num2;
txt3.setText(""+num3);
(AVG)
lbl.setText("AVG");
double
num1=Double.parseDouble(txt1.getText());
double
num2=Double.parseDouble(txt2.getText());
double num3=num1+num2/2;
txt3.setText(" "+num3);
CLEAR
txt1.setText(" ");
txt2.setText(" ");
txt3.setText(" ");
lbl.setText(" ");
OUTPUT
Q2:
NCC Cadet
Percentage
int fmarks = Integer.parseInt(txtfmarks.getText());
int smarks = Integer.parseInt(txtsmarks.getText());
int Total = fmarks+smarks;
float per = (total/200)*100;
if(chkNcc.isSelected())
per = per+3;
txtPercentage.setText(“”+per);
80
Second Term Marks
NCC Cadet
Percentage 75
Q3:
CODING
// TODO add your handling code here:
int i;
Color x=Color.red;
i =jList1.getSelectedIndex();
switch(i){
case 0:x=Color.RED;
break;
case 1:x=Color.BLUE;
break;
case 2:x=Color.MAGENTA;
break;
case 3:x=Color.cyan;
break;
case 4:x=Color.YELLOW;
break;
case 5:x=Color.gray;
break;
}
if(jCheckBox1.isSelected()==true)
jLabel1.setBackground(x);
else
jLabel1.setBackground(Color.white);
if(jCheckBox2.isSelected()==true)
jButton1.setBackground(x);
else
jButton1.setBackground(Color.white);
if(jCheckBox3.isSelected()==true)
jTextField1.setBackground(x);
else
jTextField1.setBackground(Color.white);
OUTPUT
Q4:
CODING
// TODO add your handling code here:
double a,b,c,d,dm = 0,ar=0,per=0,circum=0;
a
=Double.parseDouble(jTextField1.getText());
b
=Double.parseDouble(jTextField2.getText());
c
=Double.parseDouble(jTextField3.getText());
d
=Double.parseDouble(jTextField4.getText());
if(jRadioButton1.isSelected()==true){
if(jCheckBox1.isSelected()==true)
ar=(3.14*c*c);
JOptionPane.showMessageDialog(null,"Area of
circle is"+ar);
if(jCheckBox4.isSelected()==true)
dm =(c*c);
JOptionPane.showMessageDialog(null,"Diameter
of circle is "+dm);
if (jCheckBox3.isSelected()==true)
circum =(2*3.14*c);
JOptionPane.showMessageDialog(null,
“Circumference of circle is"+circum);
if(jRadioButton2.isSelected()==true){
if(jCheckBox2.isSelected()==true)
per =(2*(a+b));
JOptionPane.showMessageDialog(null,"Perimeter
of rectangle is"+per);
if(jCheckBox1.isSelected()==true)
ar=(a*b);
JOptionPane.showMessageDialog(null,"Area of
rectangle is"+ar);
}
if(jRadioButton3.isSelected()==true){
if(jCheckBox1.isSelected()==true)
ar =(d*d);
JOptionPane.showMessageDialog(null,"Area of
Square is"+ar);
if(jCheckBox2.isSelected()==true)
per =(4*d);
JOptionPane.showMessageDialog(null,"Perimeter
of Square is "+per);
}
OUTPUT
EXIT
System.exit(0);
Q5:
CODING
String txt=day.getText();
int day=Integer.parseInt(txt);
String txt1 =mon.getText();
int mon=Integer.parseInt(txt1);
String txt2=year.getText();
int yr=Integer.parseInt(txt2);
switch(mon){
case 1:txt4.setText(""+day+"-"+"jan"+"-"+yr);
break;
case 2:txt4.setText(""+day+"-"+"feb"+"-"+yr);
break;
case 3:txt4.setText(""+day+"-"+"mar"+"-"+yr);
break;
case 4:txt4.setText(""+day+"-"+"apr"+"-"+yr);
break;
case 5:txt4.setText(""+day+"-"+"may"+"-"+yr);
break;
case 6:txt4.setText(""+day+"-"+"june"+"-"+yr);
break;
case 7:txt4.setText(""+day+"-"+"july"+"-"+yr);
break;
case 8:txt4.setText(""+day+"-"+"aug"+"-"+yr);
break;
case 9:txt4.setText(""+day+"-"+"sep"+"-"+yr);
break;
case 10:txt4.setText(""+day+"-"+"oct"+"-"+yr);
break;
case 11:txt4.setText(""+day+"-"+"nov"+"-"+yr);
break;
case 12:txt4.setText(""+day+"-"+"dec"+"-"+yr);
break;
default: txt4.setText(" Invalid input");
}
CLEAR
day.setText(" ");
mon.setText(" ");
year.setText(" ");
txt4.setText(" ");
txt4.setEditable(false);
EXIT
System.exit(0);
OUTPUT
Q6:
CODING
// TODO add your handling code here:
int a=Integer.parseInt(jTextField2.getText());
if(jRadioButton1.isSelected());
int c = (int) (a*200.00);
if(jRadioButton2.isSelected());
c= (int) (a*500.00);
if(jRadioButton3.isSelected());
c= (int) (a*900.00);
jTextField3.setText(" "+c);
if(jCheckBox1.isSelected());
disc=c*10/100;
jTextField4.setText(" "+disc);
Amt=c-disc;
jTextField5.setText(" "+Amt);
OUTPUT
Q7:
CODING
// TODO add your handling code here:
int a=Integer.parseInt(jTextField1.getText());
int b=Integer.parseInt(jTextField2.getText());
int i;
for(i=a; i<=b; i+=1)
{jTextArea1.setText(jTextArea1.getText()+i);
jTextArea1.setEditable(false);
RESET
// TODO add your handling code here:
jTextField1.setText(" ");
jTextField2.setText(" ");
jTextArea1.setText(" ");
OUTPUT
Q8:
CODING
// TODO add your handling code here:
String pwd= new String
(jPasswordField1.getPassword());
if(pwd.equals("123"))
JOptionPane.showMessageDialog(null,"Login
successfully");
else
JOptionPane.showMessageDialog(null,"Login
Failed");
}
private void
jCheckBox1ActionPerformed(java.awt.event.Actio
nEvent evt) {
// TODO add your handling code here:
if(jCheckBox1.isSelected())
jPasswordField1.setEchoChar((char)0);
else
jPasswordField1.setEchoChar((char)1);
OUTPUT
HIMANSHU
HIMANSU
Q9:
CODING
// TODO add your handling code here:
int disc = 0;
int a=Integer.parseInt(jTextField2.getText());
if(jRadioButton1.isSelected())
disc=a*10/100;
if(jRadioButton2.isSelected())
disc=a*8/100;
if(jRadioButton3.isSelected())
disc=(a);
jTextField3.setText(" "+disc);
jTextField3.setEditable(false);
jTextField4.setEditable(false);
NET AMOUNT
int disc=0,a=0;
int net=disc-a;
jTextField4.setText(" "+net);
OUTPUT
Q10:
CODING
// TODO add your handling code here:
float disc;
int q=Integer.parseInt(jTextField2.getText());
int r=Integer.parseInt(jTextField3.getText());
float amt=q*r;
jTextField4.setText(" "+amt);
if(jRadioButton1.isSelected())
disc=(10*amt)/100;
else
disc=(5*amt)/100;
jTextField5.setText((" "+disc));
float net=amt-disc;
jTextField6.setText(" "+net);
EXIT
System.exit(0);
Q11:
CODING
// TODO add your handling code here:
int a,b,c;
a=Integer.parseInt(jTextField1.getText());
b=Integer.parseInt(jTextField2.getText());
c=(int) Math.pow(a, b);
jTextField3.setText(" "+c);
jTextField3.setEditable(false);
STOP
System.exit(0);
OUTPUT
Q12:
CODING
// TODO add your handling code here:
int a; a=Integer.parseInt(txt1.getText());
if (a>=18)txt2.setText("you are eligible for
voting");
if (a<18)txt2.setText(" your are Not eligible for
voting");
if (a>=99)txt2.setText("obviously You are
eligible");
if(a>=100)
JOptionPane.showMessageDialog(null,"This is
Limit of the age");
txt2.setEditable(false);
JOptionPane.showMessageDialog(null,"Welcome
in voting age finder");
CLEAR
txt1.setText("");
txt2.setText(" ");
EXIT
System.exit(0);
OUTPUT
Q13:
CODING
// TODO add your handling code here:
int f = 0;
int a=Integer.parseInt(jTextField2.getText());
int b=Integer.parseInt(jTextField3.getText());
int c=Integer.parseInt(jTextField4.getText());
int d=Integer.parseInt(jTextField5.getText());
int g=Integer.parseInt(jTextField1.getText());
int e=(a+b+c+d);
jTextField6.setText(" "+e);
if(jCheckBox1.isSelected()==true)
f=(3000+e);
jTextField7.setText(" "+f);
int h=(g-f);
jTextField8.setText(" "+h);
EXIT
System.exit(0);
OUTPUT
Q14:
CODING
int a,b;
a=Integer.parseInt(txt1.getText());
b=a+8;
txt2.setText(""+b);
txt2.setEditable(false);
JOptionPane.showMessageDialog(null,"Welcome
in age finder");
EXIT
System.exit(0);
OUTPUT
Q15:
CODING
// TODO add your handling code here:
int tot,rate = 0;
int
nod=Integer.parseInt(jTextField2.getText());
if(jRadioButton1.isSelected())
rate=140;
else
if(jRadioButton2.isSelected())
rate=160;
if(jCheckBox1.isSelected())
rate= rate+50;
tot =rate*nod;
jTextField3.setText(" "+tot);
CLEAR
// TODO add your handling code here:
jTextField1.setText(" ");
jTextField2.setText(" ");
jTextField3.setEditable(false);
EXIT
System.exit(0);
……………………………………………
HTML
Q1:
<HTML>
<HEAD>
<TITLE> Computer Viruses</TITLE>
</HEAD>
<BODY BGCOLOR= #00ffff Topmargin=40
leftmargin=40>
<BASEFONT SIZE=3 FACE="Arial">
<IMG src="photo1.jpg" width="78" height="46"
align="left">
<H1> What is Computer Virus?</H1>
<p align=left> A <b>virus</b> is basically an
<i>executable file</i> that is designed
such that it is able to infect documents, has ability
to survive by <u>replicating</u>
itself.<br> Usually to avoid detection, a virus
disguises itself as a legitimate program that a
user would not normally suspect to be virus. </p>
<H2> What Virus can do? </H2>
<p> <font size=5 color= #ff0000 >Viruses
</font>are designed to corrupt or delete data
on the hard disk, i.e. on the FAT (File Allocation
Table).</p>
<H2> Types of Virus </H2>
<hr size=6 width=100% noshade>
<Font color= Maroon>
<p> Boot Sector Viruses </p>
<p> File or Program Viruses</p>
<a href="http://www.google.com/" ><font
color="#ffff00" size=3> Get more on
Google.com</font></a>
</BODY>
</HTML>
18
SEX:
<input type =radio name="Sex" value="M"/>Male
<input type =radio name="Sex"
value="F"/>Female<br/>
Q2:
<html>
<head>
<title> User registration </title>
</head>
<body background ="myimage.jpg" text="blue">
<h1 align=center> My Registration Page </h1>
<form id ="Sample form" method ="post" action
=' '>
First Name : <input type =text name ="real name
"/><br></br>
Last Name : <input type =text name
="Surname"/><br></br>
Password : <input type =password name
="pass"/><br></br>
Retype password :<input type =password name
="repass"/><br></br>
SEX:
<input type =radio name ="sex" value
="M"/>Male
<input type =radio name ="sex" value
="F"/>Female/>
<h2 align=center>Additional Information</h2>
<input type =checkbox name="maillist"/> put me
on mail list.<br/><br/>
<input type =reset />
<input type =Submit value ="Submit"/>
</form>
</body>
</html>
MYSQL
Q1:
Consider the tables Patient and Test
given below :
Patient
With reference to above tables, write commands in
SQL for (i) and (ii) and output for (iii)
Answers
i. Select Name,Sex,City,Test_Name from
Patient,TEST where
Patient.T_Code=TEST.T_Code and
City=”Rohtak”;
ii. Select Name,Test_Name from Patient,TEST
where Patient.T_Code=TEST.T_Code and
Test_Name =”Thyroid”;
Q2:
Consider the tables given below
and answer the questions that
follow :
(i) To display EventId, Event name, Celebrity
Id and Names of
celebrities for only those events that have
more than 10
performers. 2
Q3:
Table “Emp” is shown below. Write
commands in SQL for (i) to (iv) and output
for (v) and (vi)
ANSWERS:
I. Select * from Emp where AGE > 25;
II. Select NAME,SALARY from Emp order by
SALARY desc;
III. Select count(ID) from Emp where NAME like
“K%”;
IV. Select NAME,ADDRESS from Emp where
ADDRESS = “Delhi”;
V. Siddarth = 62000
Karan = 65000
VI.Chavi =99110766656
Raunaq = 99101393576
Q4:
Table “Emp” is shown below. Write
commands in SQL for (i) to (iv) and output
for (v) and (vi)
Q5:
Table “Order” is shown below. Write
command in sql for(i) to(iv).
Answers:
I. Select distinct(SalesPerson) from Order;
II. Select Orderid,OrderAmount from Order order
by OrderAmount;
III. Select count(OrderId) from Order where
SalesPerson like “R%”;
IV. Select OrderId,OrderDate,OrderAmount from
Order where OrderDate>”2015-09-01”;
Q6:
Consider the table ITEM given below.
Write the commands in SQL for (i) to (iv)