Professional Documents
Culture Documents
DCSD 21.2F Enterprise Application Development-1
DCSD 21.2F Enterprise Application Development-1
ADDITIONAL MATERIALS
• None
import product.Device;
Page 1 of 5
Question 02[20 Marks]
try{
String mytext=null; // statement 1
System.out.println(mytext.length()); //statement 2
}
catch(ArithmeticException ex)
{ System.out.println(ex.getMessage());
}
C. You are required to write a java thread application to store characters of a string given in an array
and output the reverse of the string. The thread should sleep 1000 milliseconds once characters
are stored in the array. It is required to set the name and priority of the thread. (10 Marks)
Page 2 of 5
Question 03[20 Marks]
A. You are required to consider below string created. Write outputs of below string operations from
I to V.
I. string1.charAt(3);
II. string1.replace(1,”L”);
III. string1.equals(“AbCdRgw”);
IV. string1.toUpperCase();
V. string1.indexOf(“W”) (5 Marks)
B. Write a java program to write a set of characters in a string to a text file. (5 Marks)
C. Write a java application to store temperatures and names of 10 cities in Sri Lanka using Map
interface and output names of the cities whose temperatures exceed 35(Celsius). (5 Marks)
D. Write a lambda expression to execute the method in interface student. It should output students’
details received to parameters. (5 Marks)
Interface: Student
Page 3 of 5
Question 04[20 Marks]
A. What is an event in programming? (3 Marks)
B. Why are event listeners required to handle events in java programming? (3 Marks)
C. List four event classes and relevant listeners. (4 Marks)
D. The following screen is a part of the Banking Application. You are required to write an event
handling program to output the interest rate based on the loan type and loan amount when the
button “calculate” is clicked by the user. (10 Marks)
Information:
Loan Type Annual Interest Rate
Housing 8%
Vehicle 12%
Personnel 6%
Screen:
Page 4 of 5
Question 05[20 Marks]
A. Write a java class to create and return database connection to following mentioned database.
(5 Marks)
Database Name : TMS
Username : pest
Password : wtrq#123
B. You are required to write a java program to accept employee Id and Employee Grade given by
user and record them in the table below. User response should be given once record is submitted.
Assume the table is created in above database. (10 Marks)
Screen:
C. Briefly explain the way of applying MVC design pattern to execute above scenario. You may
use diagrams if required. (5 Marks)
Page 5 of 5