Professional Documents
Culture Documents
Shashwat Practicle File Class XII
Shashwat Practicle File Class XII
XII-A
1| Page
Table of Contents
Certificate
03
ACKNOWLEDGEMENT
04
HTML
74
75
MY MYSQL
2| Page
CERTIFICATE
3| Page
ACKNOWLEDGEMENT
4| Page
5| Page
Q1: Develop a compound interest calculator application as per given screen snapshot to calculate total
amount for given amount, rate of interest and time using (A= P(1+R/100) and interest I= A-P.
DESIGN VIEW
OUTPUT
6| Page
CODING
private void closeActionPerformed (java.awt.event.ActionEvent evt){
7| Page
Q2 a java application to print a pattern for given character and steps, as per given screen shots.
DESIGN VIEW
OUTPUT
8| Page
CODING
private void clearActionPerformed (java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
t1.setText("");
t2.setText("");
ta.setText("");
9| Page
Q3.Develop a simple calculator as per given screen shot to implement +,-,* and / operations. The text
boxes get cleared when “c” butter is clicked.
DESIGN VIEW
OUTPUT
10 | P a g e
CODING
private void clearActionPerformed (java.awt.event.ActionEvent evt)
11 | P a g e
int c=a*b;
t3.setText(""+c);
Q4.Develop a application for calculating amount based on the distance and weight of goods.
DESIGN VIEW
OUTPUT
12 | P a g e
CODING
private void closeActionPerformed (java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
DESIGH VIEW
OUTPUT
14 | P a g e
CODING
private void closeActionPerformed (java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
15 | P a g e
Q6.Program to find the area and perimeter of the circle, rectangle and square.
DESIGN VIEW
16 | P a g e
OUTPUT
CODING
private void squareActionPerformed (java.awt.event.ActionEvent evt) {
// TODO add your handling code here
area.setVisible(true);
perimeter.setVisible(true);
17 | P a g e
1.setVisible(false);
b.setVisible(false);
r.setVisible(false);
3.setVisible(true);
ti.setVisible(false);
t2.setVisible(false);
t3.setVisible(false);
t4.setVisible(true);
18 | P a g e
opt=3;
switch (opt)
//circle
case 1:
double r-Double.parseDouble(t3.getText());
if (area.isSelected()) {
double pi-Math.PI;
double area-pi*r*r;
t5.setText ("Area of ciecle is: " + area);
//rectangle
case 2:
1-Integer.parseInt(ti.getText());
b=Integer.parseInt(t2.getText());
if (area.isSelected()) {
double area=l*b;
t5.setText ("Area of rectangle: " + area);
else
if (perimeter.isSelected()) {
double perimeter=2* (1+b);
t5.setText ("Perimeter of rectangle: " + perimeter);
// square
case 3:
s=Integer.parseInt(t4.getText());
if(area.isSelected()) {
double area=3*3;
t5.setText ("Area of square: " + area);
else
if (perimeter.isSelected()) {
double perimeter=4*3;
t5.setText ("Perimeter of square: " + perimeter);
//rectangle
case 2:
1-Integer.parseInt(ti.getText());
b=Integer.parseInt(t2.getText());
if (area.isSelected()) {
double area=l*b;
t5.setText ("Area of rectangle: " + area);
else
if (perimeter.isSelected()) {
double perimeter=2* (1+b);
t5.setText ("Perimeter of rectangle: " + perimeter);
// square
case 3:
s=Integer.parseInt(t4.getText());
if(area.isSelected()) {
19 | P a g e
double area=3*3;
t5.setText ("Area of square: " + area);
else
if (perimeter.isSelected()) {
double perimeter=4*3;
t5.setText ("Perimeter of square: " + perimeter);
Q7.Program to find deposit, withdrawal and check the status of the account.
DESIGN VIEW
20 | P a g e
OUTPUT
CODING
21 | P a g e
private void cmdCalcActionPerformed (java.awt.event. ActionEvent evt) {
int R, eng, acc, bst, inf, eco, tot; // Marks and total
float per;
String Name, Gr="";
R- Integer.parseInt(txtRoll.getText());
eng - Integer.parseInt(txtEng.getText());
acc - Integer.parseInt(txtAcc.getText());
bst - Integer.parseInt(txtBst.getText());
inf - Integer.parseInt(txtInf.getText());
eco - Integer.parseInt(txtEco.getText();
// Total mark
tot - eng + acc + bst + inf + eco;
// Percentage
per - tot / 5;
if (per >= 90)
Gr = "A+";
else
if (per >= 80 && per < 90)
Gr = "A";
else
if (per >= 70 && per < 80)
Gr="B";
else
if (per >= 60 && per < 70)
Gr = "C";
else
if (per >= 50 66 per < 60)
Gr - "D";
else
if (per < 50)
Gr = "F";
// Displaying total, percentage and grade
txtTotal.setText (Integer.toString(tot));
txt Per.setText (Float.toString(per));
txtGr.setText (Gr);
22 | P a g e
Q8.Develop a application as per given screen shot to add, remove the given members of list and display
the selected item in a text field using list control.
DESIGN VIEW
OUTPUT
CODING
23 | P a g e
private void addActionPerformed (java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int a Integer.parseInt(t1.getText());
int b=Integer.parseInt(t2.getText());
int c=Integer.parseInt(t3.getText());
int d=a+b+c;
t4.setText(""+d);
24 | P a g e
Q 9.Develop a application for happy shopping – a retail chain involved in sales of readymade garments. The
happy shopping offers discount to its members holding platinum, gold and sliver card. The 10% discount is given
to platinum, 5% to gold and 3% silver card holder on sale amount.
DESIGN VIEW
OUTPUT
25 | P a g e
CODING
private void cmdListActionPerformed (java.awt.event.ActionEvent evt) {
// Creating a string object City
String City = txtCity.getText();
// Creating a ListModel object dModel to perform DefaultListModel
// method operations
DefaultListModel dModel = (DefaultListModel) Listi.getModel();
// Method to add elements into Listi control
dModel.addElement (City);
// Sets the data model for jListi control
jListi.setModel (dModel);
26 | P a g e
private void cmdclearActionPerformed (java.awt.event.ActionEvent evt) {
txtCity.setText("");
else
JOptionPane. shovMessageDialog(this, "Note name is selected from list");
27 | P a g e
Q10.Develop a billing application for happy application shopping-a retail chain involved in sales of
readymade garments.The happy shopping offers discount to its members holding platinum,gold and
silver card.The 10% discount is given to platinum,5% to gold and silver card holder on sale amount.
DESIGN VIEW
OUTPUT
28 | P a g e
CODING
private void cmdClearActionPerformed (java.awt.event. ActionEvent evt) {
txtPID.setText("");
txtDesc.setText("");
txtQty.setText("");
txtPrice.setText("");
txtSub.setText("");
txtTax.setText("");
txtCharge.setText("");
txtTotal.setText("");
optA.setSelected(true);
29 | P a g e
Q11.Thr entertainment paradise –theatre in delhi wants to develop a computerized booking system. The proposal
interface is given below.the theatre offers different types of seats.the ticket rates are: stalls- a discount -652/-, circle- 750/-,
upper class-850/-.a discount is given of 10
DESIGN VIEW
OUTPUT
30 | P a g e
CODING
private void exitActionPerformed (java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
31 | P a g e
Q12 . Abc consultancy is a placement organization, assist job seekers. The
entry form has to be designed to facilitate the registration process with the
following features.
DESIGN VIEW
OUTPUT
32 | P a g e
CODING
private void calculateActionPerformed (java.awt.event. ActionEvent evt)
// TODO add your handling code here:
double d=0;
int s=Integer.parseInt(t4.getText());
int p=0;
if (box.isSelected())
p=1000;
else
if (stall.isSelected())
p=625;
if (circle.isSelected())
p=750;
else
if (upperclass.isSelected())
p=850;
double a=p*3;
if (cash.isSelected())
d=8;
else
if (credit.isSelected())
d=5;
else
d=10;
double n-a-d;
t2.setText(""+d);
t3.setText(""+n);
33 | P a g e
.
Q 13 Develop a application to avon tools has computerize its billing after
entering he sufficient data entered.
DESIGN VIEW
OUTPUT
34 | P a g e
CODING
private void submitActionPerformed (java.awt.event. ActionEvent evt) {
// TODO add your handling code here:
String n=t1.getText();
String title="";
if (m.isSelected())
title="Mr.";
else
title="Mrs";
String stream="";
if(science.isSelected())
stream="science";
else
if (commerce.isSelected())
stream="commerce";
else
stream="arts";
String qualification="";
if(s.isSelected())
qualification="3";
if(g.isSelected()).
qualification="graduate";
if (pg.isSelected())
qualification="post graduate";
JOptionPane.showMessageDialog(null, title+3+"You are registered for"
+stream+qualification);
35 | P a g e
if(g.isSelected())
3.setSelected (true);
DESIGN VIEW
OUTPUT
36 | P a g e
CODING
private void CLEARActionPerformed (java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
t1.setText("");
t2.setText("");
t3.setText("");
37 | P a g e
Q 15.Develop a application to avon tools has computerize its billing after
entering he sufficient data entered.
DESIGN VIEW
38 | P a g e
OUTPUT
CODING
private void EXITActionPerformed (java.awt.event. ActionEvent evt) {
// TODO add your handling code here:
int ans=0;
ang=JOptionPane.showConfirmDialog(null,"Do you want to Exit");
if (ang==JOptionPane. YES_OPTION);
System.exit(ans);
39 | P a g e
private void EXITActionPerformed (java.awt.event. ActionEvent evt) {
// TODO add your handling code here:
int ans=0;
ang=JOptionPane.showConfirmDialog(null,"Do you want to Exit");
if (ang==JOptionPane. YES_OPTION);
System.exit(ans);
DESIGN VIEW
40 | P a g e
OUTPUT
CODING
private void BtnPlusActionPerformed(java.awt.event.ActionEvent evt) { float x,y,z;
x=Float.parseFloat(TxtNum1.getText());
y=Float.parseFloat(TxtNum2.getText());
z=x+y;
TxtResult.setText(""+z);
}
42 | P a g e
Q17: Understanding and use of Nested conditions in the Real life applications.
A Quick Fox Transport Co. wants to develop an application for calculating
amount based on distance and weight of goods.
The charges (Amount) to be calculated as per rates given below.
DESIGN VIEW
OUTPUT
44 | P a g e
CODING
private void BtnCalActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
float amt;
float wt=Float.parseFloat(TxtWeight.getText());
float km=Float.parseFloat(TxtDist.getText());
if (km >= 500)
{
if (wt>=100)
amt = km*5;
else if (wt >= 10)
amt = km * 6;
else
amt = km *7;
}
else
{
if (wt >= 100)
amt = km*8;
else
amt = km *10;
}
TxtAmt.setText(""+amt);
}
45 | P a g e
Q19. Develop a Billing application for Happy Shoping- A retail chain involved in
sales of Readymade garments. The happy Shoping offers discount to its
members holding Platinum, Gold and Silver card.
The 10% discount is given to Platinum card, 8% to Gold Card and 5% to
Silver Card holders on sales amount.
DESIGN VIEW
OUTPUT
46 | P a g e
Coding: private void BtnCalculateActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
float rt,qty,amt,dis,net;
rt=Float.parseFloat(TxtRate.getText());
qty=Float.parseFloat(TxtQty.getText());
amt=rt*qty;
if(RdBtnPlatinum.isSelected()==true)
dis=amt*10/100;
else if(RdBtnGold.isSelected() == true)
dis=amt*8/100;
else
dis=amt*5/100;
net=amt-dis;
TxtAmt.setText(""+amt);
TxtDisc.setText(""+dis);
TxtNet.setText(""+net);
}
47| P a g e
Q20 : To make a program which appends the information given.
DESIGN VIEW
OUTPUT
48 | P a g e
Code : For Submit Button –
String a = t1.getText();
String b = t9.getText();
String c = t3.getText();
String d = t4.getText();
String e = t5.getText();
String f = t6.getText();
:"+c+"\n"+"Street :"+d+"\n"
49 | P a g e
Q21: To make a calculator.
DESIGN VIEW
OUTPUT
50 | P a g e
CODING
For add button :
Double n1,n2,n3;
n1 = Double.parseDouble(t1.getText());
n2 = Double.parseDouble(t2.getText());
n3 = n1+n2;
l1.setText(""+n3);
Double n1,n2,n3;
n1 = Double.parseDouble(t1.getText());
n2 = Double.parseDouble(t2.getText());
n3 = n1-n2;
l1.setText(""+n3);
Double n1,n2,n3;
n1 = Double.parseDouble(t1.getText());
n2 = Double.parseDouble(t2.getText());
n3 = n1*n2;
l1.setText(""+n3);
51 | P a g e
For divide button :
Double n1,n2,n3;
n1 = Double.parseDouble(t1.getText());
n2 = Double.parseDouble(t2.getText());
n3 = n1/n2;
l1.setText(""+n3);
t1.setText("");
t2.setText("");
l1.setText("");
52 | P a g e
Q22 : To make a program that counts integers between two given integers.
DESIGN VIEW
OUTPUT
53 | P a g e
CODING
For Count button :
double i =Double.parseDouble(t1.getText());
double j =Double.parseDouble(t2.getText());
if(j<i)
{for(;j<=i;j++){
ta.append(" "+j);}
else
{for(;i<=j;i++){
ta.append(" "+i);
}}
54 | P a g e
Q23 : To create a LCM and HCF calculator.
DESIGN VIEW
OUTPUT
55 | P a g e
CODING
For Calculate Button :
int a=Integer.parseInt(one.getText());
int b=Integer.parseInt(two.getText());
while (y!=0)
{w=y;
y=x%w;
x=w;}
z=(a*b)/x;
56 | P a g e
Q24 : To create percentage calculator.
DESIGN VIEW
57 | P a g e
OUTPUT
CODING
For Calculate Button :
int P= Integer.parseInt(p.getText());
int C= Integer.parseInt(c.getText());
int M= Integer.parseInt(m.getText());
int E= Integer.parseInt(e.getText());
int I= Integer.parseInt(i.getText());
double O;
O=(P+C+M+E+I)/5;
String G=null;
if (O>=90) { G="A+";}
58 | P a g e
G = "A-";}
G = "B+";}
G = "B-";}
G = "C+";}
G = "C-";}
else {
s.s
s.setText(null);
System.exit(0);
59 | P a g e
Q25 : To create a registration for placements of job seekers.
DESIGN VIEW
60 | P a g e
OUTPUT
61 | P a g e
CODING
: For Submit Button
if(pgtcb.isSelected()==true)
gradcb.setSelected(true);
intercb.setSelected(true);
if(gradcb.isSelected()==true)
intercb.setSelected(true);
if(malerb.isSelected())
else if(femalerb.isSelected())
JOptionPane.showMessageDialog(null,str);
gradcb.setSelected(false);
intercb.setSelected(false);
pgtcb.setSelected(false);
name.setText(null);
malerb.setSelected(false);
femalerb.setSelected(false);
System.exit(0);
62 | P a g e
Q26 : Design an application in which user enters his chat ID and City
DESIGN VIEW
OUTPUT
63 | P a g e
CODING
For Login Button:
String name=t1.getText();
String city=(String)c1.getSelectedItem();
64 | P a g e
Q27 : To design a simple purpose dialog through the application.
DESIGN VIEW
OUTPUT
65 | P a g e
CODING
For Show Button:
JOptionPane.showMessageDialog(null,”Merry Christmas”);
66 | P a g e
Q 28: To design that decides the eligibility of the user as per his age.
DESIGN VIEW
OUTPUT
67 | P a g e
CODING
For Check Eligibility Button:
try{
JOptionPane.showMessageDialog(null,"Is Eligible");
else
catch(NumberFormatException e){
68 | P a g e
Q 29: To create a table that can receive input of the user and also display total count of records.
DESIGN VIEW
OUTPUT
69 | P a g e
CODING
For Add row Button:
Tbl.addRow(x);
JOptionPane.showMessageDialog(null, tbl.getRowCount());
int a = tbl.getRowCount();
Object A = tbl.getValueAt(0,2);
Object val = new Object();
int cnt = 1;
String msg = new String();
int i;
for(i=1; i<a; ++i)
{val = tbl.getValueAt(i,2);
if(val.equals(A))
{cnt++;}
else {msg = msg+"Class "+tbl.getValueAt(i-1,2)+" has "+cnt+" students.\n";
cnt = 1;
A= tbl.getValueAt(i,2);}}
msg = msg+" Class "+tbl.getValueAt(i-1,2)+" has "+cnt+" students.\n";
JOptionPane.showMessageDialog(null,msg);
System.exit(0);}
70 | P a g e
Q 30: To create a table that can receive input of the user and manage an address book.
DESIGN VIEW
71 | P a g e
OUTPUT
72 | P a g e
CODING
For Add Record Button:
t2.setText("");
t3.setText("");
t4.setText("");
int r = tbl.getRowCount();
JOptionPane.showMessageDialog(null,"Total Records in the address in the book:"+r);
System.exit(0);}
int c = Integer.parseInt(t5.getText());
int r = Integer.parseInt(t6.getText());
Object A = t6.getText();
c = c-1;
int i;
for(i=0;i<r; ++i)
{Object f = tbl.getValueAt(i,c);
if(f.equals(A))
{JOptionPane.showMessageDialog(rootPane,"Exists in Record");}
else {JOptionPane.showMessageDialog(rootPane, "Record with this value doesn't exist");}}
73 | P a g e
74 | P a g e
Output Window
Codeing:
75 | P a g e
Output Window
Codeing:
<html>
<head><title> USING FORM</title>
<body bgcolor="yellow">
<font color="red">
<CENTER><H1>FREE MALL INDIA.COM</H1></CENTER>
<CENTER><H4>GET A FREE MALL INDIA! ID AND CONNECT TO PEOPLE</H4></CENTER>
<label="GENDER.....">GENDER.....</label>
<input type="RADIO" NAME="GENDER" VALUE="FEMALE">FEMALE
<input type="RADIO" NAME="GENDER" VALUE="MALE">MALE<BR>
<BR><BR>
<label="COUNTRY">COUNTRY</label>
<SELECT>
<OPTION></OPTION>
76 | P a g e
<OPTION>INDIA</OPTION>
<OPTION>USA</OPTION>
<OPTION>AUSTRALIA</OPTION>
</SELECT>
<BR><BR>
<CENTER>
<label="SELECT AN ID AND PASSWORD">SELECT AN ID AND PASSWORD</label></CENTER>
<BR><BR>
<input type="CHECKBOX" NAME="PROFESSION" VALUE="EMPLOYED">EMPLOYED
<input type="CHECKBOX" NAME="PROFESSION" VALUE="UNEMPLOYED">UNEMPLOYED</BR>
<TEXTAREA ROWS=5 COL=5 NAME="COMM">
COMMENTS</TEXTAREA>
<input type="RESET" VALUE="RESET">
<input type="SUBMIT" VALUE="SUBMIT">
</FORM>
</font>
</body>
</html>
77 | P a g e
Output Window
Codeing:
<html>
<head><title>FORm</title>
<body bgcolor="yellow">
<font color="red">
<FORM ACTION="SHASHWAT@GMAIL.COM" METHOD="GET">
<label="E-MAIL">E-MAIL</label>
78 | P a g e
<input type="TEXT" ID="E NAME"><BR><BR>
<label="COUNTRY">COUNTRY</label>
<SELECT>
<OPTION></OPTION>
<OPTION>INDIA</OPTION>
<OPTION>USA</OPTION>
<OPTION>AUSTRALIA</OPTION>
</SELECT>
<BR><BR>
<input type="RADIO" NAME="GENDER" VALUE="FEMALE">FEMALE
<input type="RADIO" NAME="GENDER" VALUE="MALE">MALE</BR>
<BR><BR>
<input type="CHECKBOX" NAME="PROFESSION" VALUE="EMPLOYED">EMPLOYED
<input type="CHECKBOX" NAME="PROFESSION" VALUE="UNEMPLOYED">UNEMPLOYED</BR>
<TEXTAREA ROWS=5 COL=5 NAME="COMM">
COMMENTS</TEXTAREA>
<input type="RESET" VALUE="RESET">
<input type="SUBMIT" VALUE="SUBMIT">
</FORM>
</font>
</body>
</html>
79 | P a g e
80 | P a g e
Question1: Consider the table empl given below and run the following Queries.
Queries:
1. List the details of those employees whose annual salary is between 25000 and 40000.
SELECT * FROM empl where sal BETWEEN 2500 AND 4000;
2. Display the name of employees whose name contains ‘A’ as the 4 alphabet.
th
81 | P a g e
3. Display Name, Job and Salary of employees who do not have a manager.
5. Display details of employees who earn more commission than their salaries.
82 | P a g e
Question 2 : Consider the table EMPLOYEE given below and run the following Queries.
Queries:
1. For record with ID=4 update record with last Name, User ID and Salary.
83 | P a g e
3. Add column Email of data type VARCHAR to the table.
ALTER TABLE employe ADD(Email VARCHAR(30));
5. Modify the salary and increases it by 1000, for all who get salary less than 5000.
84 | P a g e
85 | P a g e