Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
VIDYAGYAN
SITAPUR
Informatics Practices
Practical Record
2016-2017
VIDYAGYAN - SITAPUR Page 1 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
INDEX
Sr. No. Practical Signature
AREA OF DIFFERENT SHAPES
1
CALCULATOR
2
3 PRINT A NAME GIVEN TIMES
WHILE LOOP
4
5 using list and combobox
MU LTIPLE CHECKER
6
RAISED TO THE POWER
7
8 NUMBER ROUNDING OFF
9 CASE CHANGER
SMS TESTING
10
Add record in Mysql through JAVA
11
12 Retrieve data from Mysql in table
13 inheritance and polymorphism
14 form in html(connection to mysql)
webpage in HTML
15
16 Mysql commands
VIDYAGYAN - SITAPUR Page 2 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
1.AREA OF DIFFERENT SHAPES
SOURCE CODE
privatevoidjRadioButton1ActionPerformed(java.awt.event.ActionEvet) {
{
jLabel3.setVisible(true);
jLabel3.setText("Radius");
jLabel4.setVisible(false);
jTextField1.setEditable(true);
jTextField1.setText(" ");
jTextField2.setEditable(false);
jTextField2.setText(" ");
jButton1.setEnabled(true);
jButton2.setEnabled(false);
jButton3.setEnabled(false);
}
}
privatevoidjRadioButton2ActionPerformed(java.awt.event.ActionEvet) {
{
jLabel3.setVisible(true);
jLabel3.setText("Side");
jLabel4.setVisible(false);
jTextField1.setEditable(true);
jTextField1.setText(" ");
jTextField2.setVisible(false);
jButton1.setEnabled(false);
jButton2.setEnabled(true);
jButton3.setEnabled(false)
}
}
private void jRadioButton3ActionPerformed(java.awt.event.ActionEventevt) {
{
jLabel3.setVisible(true);
jLabel3.setText("Length");
jLabel4.setVisible(true);
jLabel4.setText("Breadth");
jTextField1.setEditable(true);
jTextField1.setText(" ");
jTextField2.setVisible(true);
jTextField2.setEditable(true);
jTextField2.setText(" ");
jButton1.setEnabled(false);
jButton2.setEnabled(false);
jButton3.setEnabled(true);
}
VIDYAGYAN - SITAPUR Page 3 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
{ double radius, Area;
radius= Double.parseDouble(jTextField1.getText());
Area=3.14*radius*radius;
jTextField3.setText(Double.toString(Area));
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
{ double side,Area;
side= Double.parseDouble(jTextField1.getText());
Area=side*side;
jTextField3.setText(Double.toString(Area));
}
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
{
double Length, Breadth,Area;
Length= Double.parseDouble(jTextField1.getText());
Breadth=Double.parseDouble(jTextField2.getText());
Area=Length*Breadth;
jTextField3.setText(Double.toString(Area));
}
OUTPUT:-
VIDYAGYAN - SITAPUR Page 4 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
2. CALCULATOR
SOURCE CODE
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int first_no= Integer.parseInt(jTextField1.getText());
int second_no= Integer.parseInt(jTextField2.getText());
int result=first_no+second_no;
jTextField3.setText(Integer.toString(result));
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
int first_no= Integer.parseInt(jTextField1.getText());
int second_no= Integer.parseInt(jTextField2.getText());
int result=first_no-second_no;
jTextField3.setText(Integer.toString(result));
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
int first_no= Integer.parseInt(jTextField1.getText());
int second_no= Integer.parseInt(jTextField2.getText());
int result=first_no*second_no;
jTextField3.setText(Integer.toString(result));
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
int first_no= Integer.parseInt(jTextField1.getText());
int second_no= Integer.parseInt(jTextField2.getText());
int result=first_no/second_no;
jTextField3.setText(Integer.toString(result));
}
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
}
VIDYAGYAN - SITAPUR Page 5 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
OUTPUT:-
3.PRINT A NAME GIVEN TIMES
SOURCE CODE:-
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int a=Integer.parseInt (jTextField2.getText ());
for (int i=1;i<=a;i++)
{
jTextArea1.setText (jTextField1.getText () +" \n "+
jTextArea1.getText ());
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setText(" ");
jTextField2.setText(" ");
jTextArea1.setText(" ");
}
OUTPUT:-
4.using while loop
VIDYAGYAN - SITAPUR Page 6 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
Souce code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
{ int More ,CountName=0;
String Name;
do{
Name=JOptionPane.showInputDialog("Enter
Members,Name");
Name=Name+"\n"+ jTextArea1.getText();
jTextArea1.setText(Name);
CountName=CountName+1;
jTextField1.setText(Integer.toString(CountName));
More=JOptionPane.showConfirmDialog(rootPane,"More Names"
,"confirm",JOptionPane.YES_NO_OPTION);
}
while(More==0);}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
jTextArea1.setText(" ");
jTextField1.setText(" ");
}
Output:
5.using list and combobox
Source code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
{
int total=0;
if(jList1.isSelectedIndex(0)==true)
{
total=total+300;
VIDYAGYAN - SITAPUR Page 7 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
JOptionPane.showMessageDialog(rootpane,"jList1.getselectedValue()+-
charges 300");
jTextField1.setText(Integer.toString(total));
}
if(jList1.isSelectedIndex(1)==true)
{
total=total+200;
JOptionPane.showMessageDialog(rootpane,"jList1.getselectedValue()+-
charges 200");
jTextField1.setText(Integer.toString(total));
}
if(jList1.isSelectedIndex(2)==true)
{
total=total+180;
JOptionPane.showMessageDialog(rootpane,"jList1.getselectedValue()+-
charges 180");
jTextField1.setText(Integer.toString(total));
}
if(jList1.isSelectedIndex(3)==true)
{
total=total+310;
JOptionPane.showMessageDialog(rootpane,"jList1.getselectedValue()+-
charges 310");
jTextField1.setText(Integer.toString(total));
}
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
{
double CP, Profit = 0, SP;
CP = Double.parseDouble(jTextField1.getText());
Profit= jComboBox1.getSelectedIndex();
SP = CP + CP *(Profit / 100);
jTextField2.setText(Double.toString(SP));
switch (jComboBox1.getSelectedIndex()) {
case 0:
Profit = 5;
break;
case 1:
Profit = 10;
break;
case 2:
Profit = 15;
VIDYAGYAN - SITAPUR Page 8 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
break;
case 3:
Profit = 20;
break;
case 4:
Profit = 25;
break;
default:
Profit = 0;
break;
}
}
}
Output:
6. MULTIPLE CHECKER
SOURCE CODE:
Privatevoid jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt)
double number=Double.parseDouble(jTextField1.getText());
if (number%3==0)
JOptionPane.showMessageDialog(this,"it is the multiple of 3");
else
JOptionPane.showMessageDialog(this,"it is not the multiple of 3");
}
private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
double number=Double.parseDouble(jTextField1.getText());
if (number%5==0)
JOptionPane.showMessageDialog(this,"it is the multiple of 5");
VIDYAGYAN - SITAPUR Page 9 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
else
JOptionPane.showMessageDialog(this,"it is not the multiple of 5");
}
private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {
doublenumber=Double.parseDouble(jTextField1.getText());
if(number%7==0)
JOptionPane.showMessageDialog(this,"it is the multiple of 7");
else
JOptionPane.showMessageDialog(this,"it is not the multiple of
7");
}
OUTPUT:-
7.RAISED TO THE POWER
SOURCE CODE:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
double number,raise,result;
number=Double.parseDouble(jTextField1.getText());
raise=Double.parseDouble(jTextField2.getText());
result=Math.pow(number, raise);
jTextField3.setText(Double.toString(result));
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setText(" ");
jTextField2.setText(" ");
jTextField3.setText(" ");
OUTPUT:
VIDYAGYAN - SITAPUR Page 10 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
8.NUMBER ROUNDING OFF
SOURCE CODE:
private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {
double number,roundednumber;
number=Double.parseDouble(jTextField1.getText());
roundednumber=Math.round(number);
jTextField2.setText(Double.toString(roundednumber));
private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {
double number,roundednumber;
number=Double.parseDouble(jTextField1.getText());
roundednumber=Math.round(number*10)/10.0;
jTextField2.setText(Double.toString(roundednumber));
private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {
double number,roundednumber;
number=Double.parseDouble(jTextField1.getText());
roundednumber=Math.round(number*100)/100.0;
jTextField2.setText(Double.toString(roundednumber));
private void jRadioButton4ActionPerformed(java.awt.event.ActionEvent evt) {
double number,roundednumber;
number=Double.parseDouble(jTextField1.getText());
roundednumber=Math.round(number*1000)/1000.0;
jTextField2.setText(Double.toString(roundednumber));
}
OUT PUT:
VIDYAGYAN - SITAPUR Page 11 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
9.CASE CHANGER
Source code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String Str=jTextField1.getText();
jTextField2.setText(Str.toLowerCase());
jTextField3.setText(Str.toUpperCase());
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setText(" ");
jTextField2.setText(" ");
jTextField3.setText(" ");
OUTPUT:
10.SMS TESTING
SOURCE CODE:
VIDYAGYAN - SITAPUR Page 12 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
private void jTextField1CaretUpdate(javax.swing.event.CaretEvent evt) {
String sms=jTextField1.getText();
int l=sms.length();
int balance;
balance=160-l;
jTextField2.setText(Integer.toString(l));
jTextField3.setText(Integer.toString(balance));
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
}
OUTPUT:
16.Mysql commands
Chapter8
1.select AccNo,cust_name,loan_amount from loan_account;
2. select cust_name,loan_amount from loan_account where instalments !=36;
VIDYAGYAN - SITAPUR Page 13 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
3.select AccNo,loan_amount from loan_account where start_date <'2009-04-01';
4.select int_rate from loan_account where start_date >'2009-04-01';
5.select * from loan_account where interest is NULL;
6.select * FRO loan_account;om loan_account where interest is NOT NULL,
7.Select length(cust_name),LCASE(cust_name),UCASE(cust_name)FROM loan_account
where int_rate<11.00;
8.select left (cust_name,3),right(cust_name,3),substr(cust_name,1,3)FROM
loan_account where int_rate>10.00;
VIDYAGYAN - SITAPUR Page 14 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
9. select round(int_rate*110/100,2)FROM loan_account where int_rate>10;
10.select dayname(start_date) from loan_account;
Chapter9
1.SELECT MAX(COST) FROM SHOES;
2.SELECT MAX(COST) FROM shoes WHERE type ='School';
3.SELECT MAX(cost+cost*margin/100)FROM shoes;
4.SELECT ROUND(MAX(cost+cost*margin/100),2) AS "Max.SP" FROM shoes;
5. SELECT AVG(qty) FROM shoes WHERE type ='Sports';
VIDYAGYAN - SITAPUR Page 15 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
6.select min(cost) from shoes;
7.SELECT MIN(cost) FROM shoes WHERE type ='School';
8.SELECT ROUND (MIN(cost+cost*margin /100),2) AS "Min. SP" FROM shoes;
9.SELECT AVG(margi n) FROM shoes;
10.SELECT AVG(cost) FROM shoes;
Chapter10
1.START TRANSACTION;
2. UPDATE Trans
SET balance = balance + 2000
WHERE Acc_No = 2001;
3. UPDATE Trans
SET balance = balance - 2000
WHERE Acc_No = 2002;
4. SAVEPOINT COOL;
5.SELECT * FROM TRANS;
VIDYAGYAN - SITAPUR Page 16 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
6.COMMIT;
SELECT * FROM TRANS;
7.START TRANSACTION;
8.UPDATE Trans
SET balance = balance + 3000
WHERE Acc_No = 2001;
9.ROLLBACK;
10.SELECT * FROM TRANS;
EXTRA PROGRAMS
PALINDRROM CHECK
SOURCE CODE:
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
long Number,Temp,RevNumber=0;
Number=Long.parseLong(jTextField1.getText());
Temp=Number;
while (Temp>0) {
RevNumber=(RevNumber*10)+(Temp%10);
Temp=Temp/10;
}
jTextField2.setText(Long.toString(RevNumber));
if (Number==RevNumber)100
JOptionPane.showMessageDialog
(this,"Number is Palindrome");
else
JOptionPane.showMessageDialog
(this,"Number is not a Palindrome");
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
jTextField1.setText("");
jTextField2.setText("");}
OUTPUT:
VIDYAGYAN - SITAPUR Page 17 of 18 Year 2016-17
Name: - Babita Verma Class XII - Informatics Practices Roll No:- 5707920
BUSINESS CALCULATOR
SOURCE CODE:-
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
double CP,Profit=0,SP;
CP=Double.parseDouble(jTextField1.getText());
Profit=jComboBox1.getSelectedIndex();
SP=CP+CP*(Profit/100);
jTextField2.setText(Double.toString(SP)); }
OUTPUT:
VIDYAGYAN - SITAPUR Page 18 of 18 Year 2016-17