SJM Vidyapeetha®
S. J. M INSTITUTE OF TECHNOLOGY
(Affiliated to Visvesvaraya Technological University, Belagavi, Recognized by AICTE,
New Delhi and Approved by Government of Karnataka)
P.B. No. 73, NH4 By-pass, Chitradurga -577 502, Karnataka State, India.
Important Lab Programs in Theory Examination
1. Write a java program to initialize and display different types of integer and
floating point variables. (Write a program to create variables of different data
types)
2. Develop a JAVA program to add TWO matrices of suitable order N.
3. Develop a stack class to hold a maximum of 10 integers with suitable methods. Develop a
JAVA main method to illustrate Stack operations.
4. A class called Employee, which models an employee with an ID, name and salary, is
designed as shown in the following class diagram. The method raise-Salary (percent)
increases the salary by the given percentage. Develop the Employee class and suitable
main method for demonstration.
5. Develop a JAVA program to create a class named shape. Create three sub
classes namely: circle, triangle and square, each class has two member
functions named draw () and erase (). Demonstrate polymorphism concepts by
developing suitable methods, defining member data and main program.
6. Develop a JAVA program to create an abstract class Shape with abstract methods
calculateArea() and calculatePerimeter(). Create subclasses Circle and Triangle that
extend the Shape class and implement the respective methods to calculate the area
and perimeter of each shape. (Abstract Class).
7. Develop a JAVA program to create an interface Resizable with methods
resizeWidth(int width) and resizeHeight(int height) that allow an object to be
resized. Create a class Rectangle that implements the Resizable interface and
implements the resize methods. (Resizable interface).
8. Develop a JAVA program to raise a custom exception (user defined exception) for
DivisionByZero using try, catch, throw and finally.
---------------------------------------------------*****------------------------------------------------------
Page 1