Chapter 3
Chapter 3
Chapter 3
PRACTICAL FILE
CLASS : - XII-B
TANISHQ
CHAPTER 3
QUESTION 1
int sum=0,num;
num =
Integer.parseInt(jTextField1.getText());
jLabel2.setText(""+sum);
CHAPTER 3
QUESTION 2
String original=jTextField1.getText();
String rev="";
int l=original.length();
for(int i=l-1;i>=0;i--,l--){
rev=rev + original.substring(l-1,l);
}
if(rev.equals(original)){
JOptionPane.showMessageDialog(this,
"YES the string is palindrome");
}
else
JOptionPane.showMessageDialog(this,
"NO the string is not palindrome");
CHAPTER 3
QUESTION 3
double cp , sp , df = 0 ;
cp=Double.parseDouble(jTextField1.getText());
sp=Double.parseDouble(jTextField2.getText());
if(cp>sp)
df = cp - sp ;
jTextField3.setText(""+df);
else if(sp>cp)
df = sp - cp ;
jTextField3.setText(""+df);
else
{jTextField3.setText("0");
JOptionPane.showMessageDialog(this,"please
select the conversion");
CHAPTER 3
QUESTION 7
double value,newvalue=0;
value = Double.parseDouble(jTextField1.getText());
if(jComboBox1.getSelectedIndex()==1)
jLabel2.setText("kg");
jLabel4.setText("g");
newvalue = value*1000;
else if(jComboBox1.getSelectedIndex()==2)
jLabel2.setText("l");
jLabel4.setText("ml");
newvalue = value*1000;
else if(jComboBox1.getSelectedIndex()==3)
jLabel2.setText("Rs.");
jLabel4.setText("p");
newvalue = value*100;
else
jTextField2.setText(""+newvalue);
CHAPTER 3
QUESTION 8
double net=0,qty;
qty=Double.parseDouble(jTextField3.getText());
if (jRadioButton1.isSelected())
net=170;
else if(jRadioButton2.isSelected())
net=220;
else
if(jRadioButton3.isSelected())
net = net-net*0.25;
else if(jRadioButton4.isSelected())
net = net-net*0.2;
else if(jRadioButton5.isSelected())
net = net-net*0.05;
net=qty*net;
jTextField4.setText(""+net);
CHAPTER 3
QUESTION 9
double bs,hra=0,da=0,gs=0,ns=0;
bs=Double.parseDouble(jTextField6.getText());
if(bs>=10000)
{da=0.25;
hra=0.3;
else if(bs>=20000)
{da=0.25;
hra=0.32;
else if(bs>=40000)
{da=0.35;
hra=0.37;
else
gs=bs+da*bs+hra*bs;
ns=gs-gs*0.1;
jTextField7.setText(""+hra);
jTextField8.setText(""+da);
jTextField9.setText(""+gs);
jTextField10.setText(""+ns);
S.NO NAME DATE REMARKS
Q.1- Design a GUI application in which the user enters a number in the text
field and on clicking the button the sum of the digits of the number
should be displayed in a label.
Q.2-Design a GUI application to accept the cost price and selling price
form the user in two text fields then calculate the profit or loss
incurred.
Q.3-Design a GUI application to accept the cost price and selling price
form the user in two text fields then calculate the profit or loss
incurred.
Q.4-Design a GUI application to accept a character in a text field and
print in a label if that character is a vowel: a, e, i, o, or u. The
application should be case sensitive.
Q.6-Design a GUI application in java to convert temperature from Celsius
to Fahrenheit or vice versa using radio buttons and two text fields
Q.7-Design a GUI application in java to convert kilograms into grams,
litres into milliliters, rupees into paisa using combobox and text fields.
Q.8-A book publishing house decided to go in for computerization. The
database will be maintained at the back end but you have to design the
front end for the company. You have to accept book code, Title, Author
and Quantity sold from the user. The Price will be generated depending
upon the book code. Net price should be calculated on the basis of the
discount given.
Bookseller - 25%
School - 20%
Customer - 5%
Q.9-A networking company decided to computerize its employee salary .
Develop an application to store employee's personal data which will be
saved in the back end. The front end should accept Name, Father's Name,
Mother's Name, Address, Gender, Basic Salary, Medical and Conveyance.
Calculate gross and net salary.
CHAPTER 3
QUESTION 4
String x=jTextField1.getText();
if (x.equals("a") || x.equals("e") ||
x.equals("i") || x.equals("o") ||
x.equals("u") ||
x.equals("A") || x.equals("E") ||
x.equals("I") || x.equals("O") ||
x.equals("U"))
{ jLabel2.setText("Character is a
vowel");}
else
{ jLabel2.setText("Character is not a
vowel");}