Sei sulla pagina 1di 3

OBJECT ORIENTED PROGRAMMING THROUGH LAB

1. Write a simple java program to print a message HELLO WORLD.


2. Write a java program to find sum of two numbers and display results the program should
accept inputs from keyboard.
3. Write a java program to find out simple and compound interest.
4. Write a java program to find largest among three numbers.
5. Write a java program to find roots of quadratic equation using switch.
6. Write an interactive program to compute an area of triangle when sides are given.
7. Write an interactive program to compute cosine of a number using the following series.
x2 x4 x6
cos ( x )=1 + +
2! 4! 6!
8. Write a java application to print Floyds triangle for N rows.
9. Write a java program to interchange rows and columns of given matrix.
10. Write a java program to illustrate initialization of ragged arrays.
11. Write a java program to find mean of array using array as parameter.
12. Write a java program to implement Simpsons rule.
13. Write a java program to implement dynamic stack.
14. Write a java program to identify duplicate elements in one dimensional array, remove
those duplicates and display remaining.
15. Design and write a class to represent a bank account that includes the following members
Data Members:
Owner Name, Account Number, Balance in the account
Method Members:
Assign initial values, deposit an amount, withdraw an amount after checking balance and
displaying the details.
16. Write a java program with static comparison methods for comparing integers and strings.
17. Write a java program to find out volume of box with possible constructor types.
18. Write a java program to illustrate object as a reference.
19. Page no: 235, 8.31
An educational institution wishes to maintain a database of its employees. The database is
divided into a number of classes whose hierarchical relationships are shown in the figure below.
staf required for each class. Specify all the classes
The figure also show the minimum information
and define methods to create the databse and retrieve individual information as and when
code name
required. Implement this application by creating multiple classes and storing them in different
files. Also, write a driver class ( called Clooge) and illustrate the execution of this application.

teacher

typist

officer

subject publication

speed

grade

regular

casual
daily wages

20. Write a java program to design three classes as student, exam and result define
appropriate data members, method members for them and write a interactive program to
model this relationship using inheritance.
21. Write a java application to illustrate polymorphism by taking graphical objects as classes.
22. Write a interactive program to illustrate hybrid inheritance through interfaces
Fig 9.1 page 236.
Assume that there are two different companies: one develops a student package and the
other develops a staff package containing relevant classess. Implement a simple
University system that makes use of classes/capabilities provided by these two packages.
23. Write a java program to implement packages using banking application.
24. Write a java application to demonstrate division by zero exception.
25. Write a java application to illustrate following exceptions
a. Class not found b. File not found
c. Number format
26. Write a java application to illustrate user-defined exception ****
27. Fig 10.30, page no: 280
Write a program that demonstrates handling of exceptions in inheritance tree. For example,
create a base class called Father and derived class called Son which extends the base class.
In Father class, implement a constructor which takes the age and throws the exception
WrongAge() when the input age<0. In Son class, implement a constructor that cases both father
and sons age and throws an exception if sons age is >=fathers age.

28. Page no. 317, fig. 11.27


Write a program to extract a portion of a character string and print the extracted string. Assume
that m characters are extracted, string starting with the nth character.
29. Fig 11.30

Write a program that reads a collection of words (say a statement) and prints words in
alphabetical order.
30. Fig 11.31
Write program that illustrates the use of Hashtable class for storing and retriving
employees records.
31. Write a java application to create an empty file.
32. Fig 12.32, page no 345
write a program which copies the contents of one file to a new file by removing
unnecessary spaces between words.
33. Fig 12.31
Write a simple program that searches for all the files(excluding the directories) with user-defined
name.
34. Write a java program to search for a given word in a file and list out number of times its
occurrence and print the line number along with its content.
35. Write a java interactive application to demonstrate thread priority.
36. Write a simple timer that can periodically print a time out message using threads.
37. Write a java program to demonstrate producer consumer problem using synchronized
methods.
38. Write a java program to display message using applets.
39. Write a java program to generate a simple calculator using applets.
40. Write a java program to play audio clip using applets.
41. Write a java program that can select only files with a .exe extension using applets from a
current directory.
42. Write a java applet to change the back ground color.
43. Write a java program to demonstrate PARAM.
44. Write a simple JDBC program that can establish a connection with database.
45. Write an interactive java program that can view required employee information from
employee database.
46. Write an interactive java program that can update the information of student database
using the statement class.
47. Write an interactive java program that can delete information from the student database
using prepared statement.

Potrebbero piacerti anche