Question Paper Code:: (10×2 20 Marks)
Question Paper Code:: (10×2 20 Marks)
:
*X10313*
12. a) Write a Java program to calculate electricity bill using inheritance. The program
should get the inputs of watts per hour and unit rate.
Assume a consumer consumes 5000 watts per hour daily for one month. Calculate
the total energy bill of that consumer if per unit rate is 7 [1 unit = 1k Wh]. (13)
(OR)
b) What is interface ? With an example explain how to define and implement
interface. (13)
• Difference between throw and throws. Give example for both. (5)
b) i) What is the purpose of thread priorities ? What are the different thread
priorities that exist ? (5)
ii) What are bounded types ? Why it is used ? Give example. (8)
15. a) i) List any five different user interface components that can generate the
events. (5)
ii) Demonstrate any four mouse event handlers with example. (8)
(OR)
b) Describe how to work with graphics to display information within window. (13)
*X10313* -3- X 10313
16. a) Write an AWT GUI application (called AWT counter) as shown in the Figure 1.
Each time the “Count” button is clicked, the counter value shall increase by 1.
Figure 1
(OR)
b) Write an addressbook class that manages a collection of person object. An
addressbook will allow a person to add, delete, or search for a person object in
the address book.
• Add method : It should add a person object to the addressbook.
• Delete method: It should remove the specified person object from the book.
• Search method: It searches the address book for a specified person and returns
the list of persons matching the specified criteria. The search can be done either
by first name, last name or person id.
–––––––––––––