Question 4 : (a) What will be displayed into jTextField1 after executing the
following code:
int N=20;
N=N+1;
if(N<21)
jTextField1.setText(Integer.toString(N+10)); else
jTextField1.setText(Integer.toString(N+15));
b) Rewrite the following program code using a Switch statement.
if(code==1)
Day=”Monday”;
else if(code==2)
Day=”Tuesday”;
else if(code==3)
Day=”Wednesday”;
else if(code==4)
Day=”Thursday”;
else
Day=”No Match”;
c) What will be displayed in jTextArea1 after executing the following
statement:
jTextArea1.setText(“LivenIn Peacet and harmony”);
d) The following code has
some error(s).Rewrite the code underlining all the corrections made:
Int P=3;sum=0;
//Declaring P and sum as Integer
{
sum=P;
P+=3;
}
while(P=<12)
jTextField1(Integer.tostring(sum));
e) Given a string object
namely ‘VALUE’, having value as “324” stored in it .What will be the result
of the following:
JOptionPane.showMessageDialog(null,”
”+(Value.length()+Integer.parseInt(value)));
f) The following code has
some error(s). Rewrite the correct code underlining all the corrections
made;
int
Total=0,Jump=5;
int I;
for(i=0,I=<5;i++)
{
Jump+=5,
Total+=Jump;
}
jTextArea1.showText(“ ”+Total);
g) Mr. Ram Kishore, the owner of the kiddi Land Enterprises
has asked his programmer Saumya to develop the following GUI in
Netbeans.
Mr.Ram accepts payment through three types of credit cards. The offer is
given according to the following scheme:
If the Bill amount is more
than Rs. 25,000/- then the customer gets an additional offer of 5%.
Write Java code for the
following:
a) To assign Additional Offer
as 0(jTextField4) and Net amount as 0(jTextField5). Also set them as
un-editable.
b) [when “Calculate Offer”
(jButton1) is clicked]
To calculate discount as per
the given criteria and display the same in jTextField3
To assign Additional offer
(jTextField4) as 5% of amount (jTextField2) as per the above condition.
To enable “Calculate Net
amount” (jButton2) button.
c) [When “Calculate Net
Amount” (jButton2) button is clicked]
To calculate net amount as
[TotalCost(jTextField2)-offer(jTextField3)]–Additional offer(jTextField4)]
To display the net amount in
jTextField5.
[2+2+1+2+1+2+1+2+2=15]
|
No comments:
Post a Comment