You are on page 1of 3

ranjeetsagar1983@rediffmail.

com

ASSINMENT-2 1.

a) While working with Netbeans, Ashita included a TextArea control which contains a list of students. What code she should write to add one more student name at the end of the TextArea? (1) b) How many times does the following loop execute? What is its type (Entry controlled or Exit controlled ) ? (2) i. int x=2,y=20; ii. while( x < = y) iii. { iv. JOptionPane.showMessageDialog(null, + x); c) Write a function in java that takes an integer number as parameter and returns its sum of digits. 2 d) What controls would you suggest for following types of inputs ? (i) To display some information (ii) Enter password (iii) To choose more than one subject from a set of subjects. (iv) To enter multiline text e) What is the purpose of return statement in a method? f) Differentiate between call by value and call by reference with example 2

1 2

2. (a) What is an abstract class? 1 (b) Given an int variable K with value 102. It is to be converted into equivalent string i.e 253. What are the two ways of doing that? 1 (c) What will be the content of jTextArea1 after executing the following statement : jTextArea1.setText( java is \nwonderful programming \tlanguage ); (d) Rewrite the following program code using do while loop. 2 int i=1, sum=0; while (i<15) { sum +=i; i +=2; } (e) Rewrite the corrected following code by underlining the corrected area int k, l = 6; int k, I = 6; k= =I+6, if ( k=l) { }
9835554572

ranjeetsagar1983@rediffmail.com

else jTextField1.getText(K And L are Unequal); jTextField1.setText(K And L are equal); (f) What will be the contents of JTextField1 and JTextFiled2 after executing the following code 2 jTextField1.setText(Math.round(2.5)+""); jTextField2.setText("Micro".concat("System")); (g) ABC Sales Enterprise wants developed a software to make the bill for their customer. GUI for the application given below.

Write the java statement for the following requirements. a) Write the statement to make the text fields (txtDiscount) and txtNet non- editable. 2 b) Calculate discount and net amount for calculate button based on the following criteria. 2 Sales Amount >=5000 >=3000`
>=1000

Discount 5 3
1

c) Write the statement to clear all textfields when clicking the clear button. d) Write the java statement for the exit button to close the application.

1 1

3. a) Explain Function overloading and use of super keyword with a suitable program in java. 3 b) Explain Hierarchical inheritance with suitable program in java
9835554572 2

ranjeetsagar1983@rediffmail.com

9835554572