CBSE Class XI Informatics Practices Introduction to Programming Questions
CBSE Class XI Informatics Practices Introduction to Programming Questions
COM
m
Ans: (i) jListBox
o
(ii) jComboBox
y . c
a
Ans: getSelectedIndex() and getSelectedValue()
t o d
8. Write code to add an element (“New Course”) to a list (SubList) at the beginning of the list.
ies
Ans: SubList.add(0,”New Course”);
d
9. Describe the three common controls. Also give some of their properties.
tu
Ans:
.s
(i) jButton text,icon
(ii) jLabel text,border
w
(iii) jTextField text,font
w w
10. By default a combo box does not offer editing feature.How would you make a combo box editable.
Ans: By setting its editable property to false.
11. Write Name the component classes of Swing API for the following components-
(a) frame (b) button
Ans:(a)JFrame(b)JButton
12. What is the name of event listener interface for action events ?
Ans: ActionPerformed
16. Which method of list is used to determine the value of selected item, if only one itm is selected.
Ans: getSelectedValue()
19. Which expression is used to print the value of a variable "x" of type int.
Ans: jTextField1.setText("x = " + x);
m
Ans: Numeric type , Fractional type, Character type and Boolean type.
. co
22. Which events gets fired when a user click a JButton and JRadioButton.
y
Ans: ActionPerformed
d a
o
a. do while Loop b. for Loop c. while Loop d. None of these
t
Ans: none of these
ies
24. What will be used if there are two or more possible options.
d
Ans: is else if and switch
s tu
Ans: infinite loop
w .
w
26. Which braces is used to enclose statements in a block statement.
w
Ans: { } Curly braces
29. Which of the following component is the best suited to accept the country of the
user?
A. List
B. Combo box
C. Radio button
D. Check box
Ans: List and combo box
30. Which construct will be used to find the sum of the first 10 natural numbers?
Ans: for loop
m
3. Differentiate between:
o
Ans:
. c
a) Text field and Text area components :
y
The Text Field allows the user to enter a single line of text only. But Text Area component allows to accept
a
multiline input from the user or display multiple lines of information.
t o d
ies
The Text Field displays the obtained text in unencrypted form whreas password field displays the obtained
text in encrypted form. This component allows confidential input like passwords which are single line.
d
c) parseInt() and parseDouble() methods:
u
parseInt() is used to convert a string value to Integer type whereas parseDouble() is used to convert a
t
string value to type Double.
.s
w
4. What is a Variable?
Ans: Variables are named temporary storage locations.
w w
5. Why are data types important?
Ans: Data Types define the way the values are stored, the range of the values and
the operations that can be performed on that type.
7. What is an identifier?
Ans:Identifiers are fundamental building block of a program and are used as the general terminology for the
names given to different parts of the program viz. variables, objects, classes,functions, arrays etc.
12. What is the main difference between a combo box and a list box?
Ans: The List Box does not have a text field the user can use to edit the selected item, wheras a Combo
Box is cross between a text field and a list.
13. Explain the use of for statement along with its syntax.
Ans: The for loop repeat a set of statements till a test condition is satisfied.
The syntax of the for loop is:
Syntax
for( initialization; test exp; increment/decrement exp)
{
statements;
}
15. What is the purpose of if statement? Name the different forms of if statement.
Ans: The if statement allows selection (decision making) depending upon the outcome of a condition.
m
a) simple if
o
b) if else
c
c) if - else if – else
y .
a
16. What is the purpose of default clause in a switch statement?
d
Ans: The default statement gets executed when no match is found in switch.
t o
17. What is the main difference between a while loop and a do while loop?
ies
Ans: In while loop test expression is evaluated at the beginning of the loop whereas in do while loop the test
expression is evaluated at the bottom of the loop. This means that do-while loop is executed at least once.
tu d
.s
18. How is the if…else if combination more general than a switch statement?
w
Ans:The switch statement must be by a single integer control variable, and each case section must
w
correspond to a single constant value for the variable. The if…else if combination allows any kind of
w
condition after each if.
19. Excessive comments add time to the execution of your program. (True/False).
Ans: False because comments are non executable.
(i) System.out.printl(“Hello”.charAt(3));
(ii) System.out.printl(“Good morning”.substring(4));
Ans:
(i) l
(ii) morning
intx , y = 0;
for(x=1;x<=5;++x)
y = x++;
--y ;
Ans: 7 4
o m
c
int f=1,i=2;
.
do
{ f*=i;
}while(++i<5);
ay
System.out.println(f);
t o d
ies
Ans: 24
tu d
Connection , statement created
.s
w
String str=”select * from emp”;
w
Resultsetrs= stmt.executeQuery(str);
w
rs.last();
int r= rs.getRow();
JOptionPane.showMessageDialog(null,””+r);
Ans : if emp table has 5 records it will display 5
int j=10,k=12;
if(k>=j)
{k=j;
J=k;
}
Ans: 10 10
i=0;
while (i> 20)
{
//Statements
}
Ans: 0 times
i=0;
do
{
//Statements
}while (i> 20);
Ans: 1 time
9. What will be the contents of jTextield1 and jTextField2 after executing the following statement:
o m
c
s.insert(0,’E’);
.
s.reverse();
jTextField1.setText(“”+c);
ay
d
jTextField2.setText(s.toString());
o
Ans:
t
ies
29
htlaeWnommoCE
tu d
.s
10. What will be the contents of jTextield after executing the following statement:
int num=4;
ww
w
num=num+1;
if(num>5)
jTextField1.setText(Integer.toString(num));
else
jTextField1.setText(Integer.toString(num*4));
Ans : 7
int First = 7;
int Second = 73;
First++;
if (First+Second> 90)
jlabel1.setText("value is 90 ");
else
jlabel1.setText("value is not 90 ");
Ans :value is not 90
13. How many times will the following loop get executed?
x = 5;
y = 36;
while ( x <= y)
{
x+=6;
}
Ans: 6
o m
y . c
14. What will be the content of the jTextArea1 after executing the following code?
a
Int Num = 1;
d
do
o
{
t
ies
jTextArea1.setText(Integer.toString(++Num) + "\n");
Num = Num + 1;
}while(Num<=10)
d
Ans: 10
s tu
.
15. What will be the contents of jTextfield1 and jTextfield2 after executing the following code:
w
w
String s=”KENDRIYA VIDYALAYA GUNA”
w
jtextfield1.setText(s.length()+” “);
jtextfield2.setText(Math.round(2.34)+“”);
Ans : 23 2
16. What will be the value of s after executing the following code?
double i,sum=2
for(i=3;i<8;++i)
{ if(i%4= =0)
{ break;
sum=Math.pow(sum,i);
}
else
sum+=i/2;
}
Ans: 150.0625
17. What will be the content of jTextField1 and jTextField2 after executing the following code:
Information Technology
18. Predict the output for tan & tan1 if sac equals 7?
v = 20 ;
do
{
JOptionPane.showMessageDialog( null , v + “ ” ) ;
} while ( v< 50 ) ;
JOptionPane.showMessageDialog( null , “ Bye “ ) ;
m
Ans: Infinite loop
. co
20. Give the value of x after executing following Java code. Also find how many times the
y
following loop will execute? :
a
int a=10;
d
int b=12;
t o
int x=5;
ies
int y=6;
while (a<=b)
{ if (a%2= =0)
else
x=x + y;
tu d
.s
x=x-y;
a=a+1;
}
Ans:11
ww
w
21. What will be the output produced by following code fragment? (1)
flaot x=9;
float y=5;
int z=(int)(x/y);
switch(z)
{
case1:x=x+2;
case2: x=x+3;
default:x =x+1;
}
System.out.println(“value of x:”+x);
Ans: 15
inti,j,n;
n=0;i=1;
do
{ n++; i++;
}
DOWNLOADED FROM WWW.STUDIESTODAY.COM DOWNLOADED FROM WWW.STUDIESTODAY.COM
DOWNLOADED FROM WWW.STUDIESTODAY.COM DOWNLOADED FROM WWW.STUDIESTODAY.COM
while(i<=5);
Ans: 5
23. What will be the output of the following program code when the user will press JButton:
m
Ans: 15 35
. co
y
24. What will be the contents of jTextField1 and jTextField2 after executing the following code:
t o
ies
jTextField2.setText(s.toLowerCase());
Ans:
d
jTextField1 : 17
tu
jTextField2 : abc micro systems
.s
w
25. What values will be assigned to the variable ua ,ub, uc and fail after execution of the following program
w
segment:
while(i<=5) {
switch ( i++ )
w
int i=0,ua=0,ub=0,uc=0,fail=0;
{ case 1 :++ua;
case 2 : ++ub; uc++;break;
case 3 :
case 4 : ++uc; ua++;ub++;break;
default : ++fail;
}
Ans: ua=1 ub=1 uc=0
int i = 1, j = 0, n = 0;
while(i<4) {
for(j=1;j<= i ; j++)
{ n+= 1;
i = i+1;
}
System.out.println(n);
}
Ans : 6
int m=100;
while(m>0)
{
if (m<10)
break;
m=m-10;
}
System.out.println(“m is “+m);
Ans: 0
o m
y . c
d a
t o
d ies
s tu
w .
w w
1. The following code has some errors. Rewrite the corrected code .
int i=2,j=5;
while j>i
{ jTextField1.getText(“j is greater”);
j--; ++i;
}JOptionPane.showMessageDialog(“Hello”);
Ans:
int i=2,j=5;
while( j>i)
{ jTextField1.getText(“j is greater”);
j--; ++i;
}JOptionPane.showMessageDialog(“Hello”);
2. Identify the errors :
m
switch(ch)
o
{ case ‘a’ :
case ‘A’ :
y . c
a
case ‘e’ :
case ‘E’ :
t o d
ies
case ‘i’ :
case ‘i’ :
case ‘u’ :
tu d
s
case ‘U’ : ++vowels;
w
break;
.
w
default : ++others;
w
Ans: two case constants doesn’t have the same value
3. inti,j=5;
i==j+5;
if(i=j)
{
jTextField1.setText(“i and j are unequal”);
jTextField2.setText(“they are not equal”); break;
}
else jTextField1.setText(“i and j are equal”);
Ans:
int i,j=5;
i=j+5;
if(i==j)
{
jTextField1.setText(“i and j are unequal”);
jTextField2.setText(“they are not equal”); break;
}
else jTextField1.setText(“i and j are equal”);
Ans :
int sum,value,inct;
int i;
for(i=0;i<=10;i++)
sum=sum+i;
inct++;
5. The following code has some error(s). Rewrite the correct code underlining all the corrections made.
int y=3;
switch(y);
{ case 1: System.out.print(“Yes its One”);
case>2: System.out.println(“Yes its more than Two”);
o m
c
break;
.
case else: System.out.print(“Invalid Number):
ay
d
ans:
o
int y=3;
t
switch(y)
ies
{ case 1: System.out.print(“Yes its One”);
break;
d
case 2: System.out.println(“Yes its more than Two”);
tu
break;
s
default:System.out.print(“Invalid Number):
.
}
ww
w
6. The following has some error(s).Rewrite the correct code underlining all the corrections made:
Inti,j=5;
i==j+5;
if(i=j)
{
jtextfield1.setText(“I and j are unequal”);
jtextfield1.setText(“I and j are not equal”);breaks;
}
else
jtextfield1.setText(“I and j are equal”)
Ans:
inti,j=5;
i=j+5;
if(i==j)
{
jTextField1.setText(“I and j are unequal”);
}
else
jTextField1.setText(“I and j are equal”)
7. Rewrite the following Java code after underling the corrections made.
int x = = 0;
Ans:
int x = 0;
M=1;
N=0;
For(;m+n<19;++n)
System.out.println(“hello”);
m
M=m+10;
Ans:
. co
y
m=1;
a
n=0;
d
for(;m+n<19;++n)
o
System.out.println(“hello”);
t
m=m+10;
ies
9. The following code has some error(s). Rewrite the correct code underlining all the corrections made.
d
int y=6,p;
tu
do
s
{ y=3.14*y;
if p=2
p=y%10;
w .
w
System.out.print(“Two”);
w
while(y>1)
Ans:
int y=6,p;
do
{ y=3.14*y;
p=y%10;
if (p==2)
System.out.print(“Two”);
}while(y>1);
Rewrite questions:
inti,sum=0;
while(i<10)
{ sum +=i;
i+=2;
}
DOWNLOADED FROM WWW.STUDIESTODAY.COM DOWNLOADED FROM WWW.STUDIESTODAY.COM
DOWNLOADED FROM WWW.STUDIESTODAY.COM DOWNLOADED FROM WWW.STUDIESTODAY.COM
for(i=0;i<10;i+=2)
{ sum +=i;
o m
while(i<=4)
y . c
a
{ j=1;
d
while(j<=i)
{ System.out.print(j);
t o
ies
++j;
d
} i++;
System.out.println();
s tu
}
w .
3. Write a equivalent while loop for the following code:
intsz=25;
w w
for(int i=0,sum=0;i<sz;i++)
sum+=i;
System.out.println(sum);
int i=0,sum=0;
while(i<sz)
{
sum+=i;
i++;
}
System.out.println(sum);
4. Rewrite the following if-else segment using switch-case statement
char ch='A';
if(ch=='A')
System.out.println("Account");
if((ch=='C') || (ch=='G'))
System.out.println("Admin");
if(ch=='F')
System.out.println("Advisor");
switch(ch)
{
case ‘A':
System.out.println("Account");
break;
case 'C':
case 'G’:
System.out.println("Admin");
break;
case 'F':
System.out.println("Advisor");
o m
. c
inti,j;
y
for(i=1,j=2;i<=6;i++,j+=2)
a
System.out.println(i++);
d
System.out.println(“Finished!!!”);
t o
ies
Ans: inti=1,j=2;
while(i<=6)
d
{System.out.println(i++);
u
i++;
t
j+=2;}
.s
System.out.println(“Finished!!!”);
ww
6. Rewrite the following code using for loop.
w
int i=0;
while(++i<20)
{ if( i==8)
break;
System.out.println(i++);
}
Ans:
int i;
for(i=1;i<20;++i)
{ if( i==8)
break;
System.out.println(i++);
}
If(k==1)
Day=”Monday”;
elseif(k==2)
Day=”Tuesday”;
elseif(k==3)
Day=”Wednesday”;
else
DOWNLOADED FROM WWW.STUDIESTODAY.COM DOWNLOADED FROM WWW.STUDIESTODAY.COM
DOWNLOADED FROM WWW.STUDIESTODAY.COM DOWNLOADED FROM WWW.STUDIESTODAY.COM
Day=”-”
Ans:
switch(k)
{
case 1: Day=”Monday”;
break;
case 2: Day=”Tuesday”;
break;
case 3: Day=”Wednesday”;
break;
default: Day=””;
}
If (num1 = =1 )
jTextField1.setText(“Number is one”);
else If (num1 = =2 )
m
jTextField1.setText(“Number is two”);
o
else If (num1 = =3 )
c
jTextField1.setText(“Number is three”);
else
jTextField1.setText(“Number is more than three”);
y .
Ans:
d a
t o
ies
Switch(num1)
{
Case 1 :
jTextField1.setText(“Number is one”);
break;
tu d
.s
case 2 :
jTextField1.setText(“Number is two”);
break;
case 3 :
ww
w
jTextField1.setText(“Number is three”);
break;
default:
jTextField1.setText(“Number is more than three”);
}
If(a==0)
System.out.println(“zero”);
If(a==1)
System.out.println(“one”);
If(a==2)
System.out.println(“two”);
If(a==3)
System.out.println(“three”);
Ans:
if(a==0)
System.out.println(“zero”);
else if(a==1)
System.out.println(“one”);
else if(a==2)
System.out.println(“two”);
else if(a==3)
System.out.println(“three”);
if(ch = = ‘E’)
east++;
if(ch = = ‘W’)
west++;
if(ch = = ‘N’)
north++;
if(ch = = ‘S’)
south++;
else
jOptionPane.showMessageDialog(null, “unknown”);
Ans:
m
Switch(ch)
o
{
Case ‘E’:
y . c
a
east++;
d
break;
t o
case ‘W’:
ies
west++;
break;
case ‘N’:
north++;
break;
tu d
.s
case ‘S’:
w
south++;
break;
default :
w w
jOptionPane.showMessageDialog(null, “unknown”);
}
Ans:
for(int i = 0;++i <20;)
{
if(i = = 8)
break;
System.out.println(++i);
}
Design Questions:
1. Design an application for Theatre Booking system. And answers the following questions :
m
(a) When the user select different seat type, then its price should be displayed in the Label.
o
c
(b) If the user enters an invalid no of seats i.e. less than I, then an error message should be displayed in
.
the dialog box.
y
( c) When the user click at the Book Seats button , then total amount (calculated as no. of seats x price per
a
seat) should be displayed along with payment method, next to the push button.
d
(c) Price per seat depend upon the seat type :
Stall 625/-
t o
ies
Circle 750/-
Upper Circle 850/-
d
Box 1000/-
u
Ans:
.s t
(a) if(jRadioButton1.isSelected()==true)
w
jLabel2.setText(“625”);
w
if(jRadioButton2.isSelected()==true)
w
jLabel2.setText(“750”);
if(jRadioButton3.isSelected()==true)
jLabel2.setText(“850”);
if(jRadioButton4.isSelected()==true)
jLabel2.setText(“1000”);
(b) int s=Integer.parseInt(jTextField1.getText());
if(s<1)
JOptionPAne.showMessageDialog(null,”Error”);
(c) int s=Integer.parseInt(jTextField1.getText());
int p=Integer.parseInt(jLabel2.getText());
int tp=s*p;
if(jRadioButton5.isSelected()==true)
jLabel5.setText(“Cash Payment of “ +tp);
if(jRadioButton6.isSelected()==true)
jLabel5.setText(“Visa Payment of “ +tp);
if(jRadioButton7.isSelected()==true)
jLabel5.setText(“American Exress Payment of “ +tp);
if(jRadioButton8.isSelected()==true)
jLabel5.setText(“Master Card Payment of “ +tp);
2. Write a java program that lets you create an address book in a table. The details to be
added in Address Book are : SNo,Name, Email Id, Phone.
Ans:
m
int sno= Integer.parseInt(jTextField1.getText());
. co
String email = jTextField3.getText();
ay
long ph= Integer.parseInt(jTextField4.getText());
t o d
ies
Object nr[]={sno,name,email,ph};
tm.addRow(nr);
tu d
.s
ww
w
3. Design the following application and answer the questions that follow :
(a) Write the code for the Clear button to clear all the textfields and checkbox. Set the default choice in the
radio button as Fixed Deposit.
(b) Write the code for the calculate button to calculate compound interest and amount and display the
values in the txtInterest and txtAmount depending on principal, rate and time.
Rate is calculated based on the time according to the following table:
m
Account Time Rate
o
Fixed Deposit <= 1 10%
. c
>1 and <=5 12%
y
>5 15%
a
Recurring Deposit <= 2 11%
d
>2 and <=7 12%
t o
>7 15%
ies
An additional rate of 2% is given to the senior citizens i.e. if the chkSR checkbox is checked.
Ans:
(a) jTextField1.setText(“”);
tu d
.s
jTextField2.setText(“”);
w
jTextField3.setText(“”);
w
w
jRadioButton1.setSelected(true);
jCheckBox1.setSelected(false);
else
{
if(t<=1)
r=10;
else if(t>1 && t<=5)
r=12;
else
r=15;
}
o m
y . c
d a
t o
ies
The grading criteria for the two streams is given below :
d
Stream Percentage Grade
Medical >=80
s tu A
.
60-80 B
ww <60 C
w
Non-Medical >=75 A
50-75 B
<50 C
(a) Write code for Calculate Percentage button to calculate the Percentage after finding the total marks of I
term and II term . Also ensure that NCC cadet gets an increment of 3% in their percentages.
(b) Write code for Calculate grade button to calculate the grade depending upon on the
stream selected according to the given criteria.
Ans:
( b) String g;
if(jRadioButton1.isSelected()==true)
{
if(p>=80)
g=”A”;
else if(p>=60 &p<80)
g=”B”;
else
g=”C”;
}
else
{
if(p>=75)
g=”A”;
else if(p>=50 &p<75)
g=”B”;
else
g=”C”;
o m
c
jLabelp.setText(“”+p);
jLabelg.setText(“”+g);
y .
d a
t o
5. Mr. Madhav works in a construction company. To calculate total wages he has developed the following
ies
GUI in NetBeans.
tu d
.s
ww
w
Male and female labours are respectively paid Rs. 150/- per day and Rs. 170/- per day. Skilled labourers
are paid extra at the rate of Rs. 100/- day. Male and female labourers from rural areas are paid 10% less
per day.
(a) When Calculate Wage button is clicked, the total wages is calculated as per the given criteria and
displayed in total wage text box.
(b) When Clear button is clicked, all the text boxes should be cleared and radio button, check box should
be deselected.
(c) Close the application when Quit button is pressed.
Ans:
(b) jTextField1.setText(“”);
jTextField2.setText(“”);
jRadioButton1.setSelected(false);
jRadioButton2.setSelected(false);
o m
jRadioButton3.setSelected(false);
y . c
jRadioButton4.setSelected(false);
d a
jCheckBox.setSelected(flase);
t o
ies
(c) System.exit(0);
tu d
.s
6. Mr. JigneshDesai an owner of Alpha Chemicals PVT ltd has asked his programmer Sweta to
w
develop the following GUI application in Netbeans:
w w
(a)To calculate service charges depending on the selection of radio button. This code will execute after
click on the calculate service charges?
(b)To calculate net price when Calculate Net price button will be clicked.
Ans:
m
else if(jRadioButton2.isSelected()==true)
sc=(15*sp)/100;
. co
y
else
a
sc=(20*sp)/100;
jLabelsc.setText(“”+sc);
t o d
ies
float sp=Float.parseFloat(jLabelsp.getText());
u d
float sc=Float.parseFloat(jLabelsc.getText());
t
s
float np=sp+sc;
w
jLabelnp.setText(“”+np);
.
w
(c) System.exit(0);
w
7. Assume the following interface built using Netbeans used for bill calculation of a ice-cream
parlor. The parlor offers three verities of ice-cream - vanilla, strawberry, chocolate. Vanilla ice- cream
costs Rs. 30, Strawberry Rs. 35 and Chocolate Rs. 50. A customer can chose one or
more ice-creams, with quantities more than one for each of the variety chosen. To calculate the
bill parlor manager selects the appropriate check boxes according to the verities of ice-cream
chosen by the customer and enter their respective quantities.
Ans:
(a) private void jBtnCalculateMouseClicked(java.awt.event.MouseEvent evt)
{
if(jchkStrawberry.isSelected()==true)
jTxtPriceStrawberry.setText("35");
o m
c
else
{
y .
a
jTxtPriceStrawberry.setText("0");
d
jTxtQtyStrawberry.setText("0");
}
t o
ies
if(jChkChocolate.isSelected()==true)
jTxtPriceChocolate.setText("50");
else
{
tu d
.s
jTxtPriceChocolate.setText("0");
w
jTxtQtyChocolate.setText("0");
w
}
w
if(jChkVinella.isSelected()==true)
jtxtPriceVinella.setText("30");
else
{
jtxtPriceVinella.setText("0");
jTxtQtyVinella.setText("0");
}
int r1,r2,r3,q1,q2,q3,a1,a2,a3,gt;
r1=Integer.parseInt(jTxtPriceStrawberry.getText());
r2=Integer.parseInt(jTxtPriceChocolate.getText());
r3=Integer.parseInt(jtxtPriceVinella.getText());
q1=Integer.parseInt(jTxtQtyStrawberry.getText());
q2=Integer.parseInt(jTxtQtyChocolate.getText());
q3=Integer.parseInt(jTxtQtyVinella.getText());
a1=r1*q1;
jTxtAmtStrawberry.setText(""+a1);
a2=r2*q2;
jTxtAmtChocolate.setText(""+a2);
a3=r3*q3;
jTxtAmtVinella.setText(""+a3);
gt=a1+a2+a3;
m
jTxtTotalAmt.setText(""+gt);
}
. co
(b) private void jBtnClearActionPerformed(java.awt.event.ActionEvent evt)
{
ay
d
jTxtPriceStrawberry.setText("");
t o
jTxtPriceChocolate.setText("");
ies
jtxtPriceVinella.setText("");
jTxtQtyStrawberry.setText("");
d
jTxtQtyChocolate.setText("");
tu
jTxtQtyVinella.setText("");
s
.
jTxtAmtStrawberry.setText("");
w
jTxtAmtChocolate.setText("");
w
jTxtAmtVinella.setText("");
w
jchkStrawberry.setSelected(false);
jChkChocolate.setSelected(false);
jChkVinella.setSelected(false);
}
8. ABC School uses the following interface built in java to check the eligibility of a student for a
particular stream from science, commerce and humanities. The user first enters the total
percentage and selects the desired stream by selecting the appropriate option button. An
additional 5% is marks is given to students of NCC.
o m
y . c
d a
t o
d ies
u
Ans: private void jBtnClearActionPerformed(java.awt.event.ActionEvent evt)
{
.s t
w
jTextField1.setText(" ") OR jTextField1.setText(null)
w
jTextField1.setText(" ") OR jTextField1.setText(null)
w
jTextField1.setText(" ") OR jTextField1.setText(null)
jTextField1.setText(" ") OR jTextField1.setText(null)
jCheckbox1.setSelected(false);
}
private void jBtnCalcPerActionPerformed(java.awt.event.ActionEvent evt)
{
int p;
p=Integer.parseInt(jTextField2.getText());
if (jCheckBox1.isSelected())
p=p+5;
jTextField3.setText(Integer.toString(p));
}
private void jBtnResultActionPerformed(java.awt.event.ActionEvent evt)
{
int p;
p=Integer.parseInt(jTextField3.getText());
if( jRadioButton1.isSelected())
{
if ( p>=70)
jTextField4.setText("Eligible for all subject");
else
jTextfield4.setText("Not Eligible for science");
}
}
private void jBtnCloseActionPerformed(java.awt.event.ActionEvent evt)
m
{
}
System.exit(0);
. co
ay
t o d
d ies
s tu
w .
w w