0% found this document useful (0 votes)
2 views

lab program file java

The document outlines the syllabus for the Object Oriented Programming with Java course at Channabasaveshwara Institute Of Technology. It includes various programming experiments that students are expected to complete, covering topics such as matrix addition, stack operations, class design, polymorphism, abstract classes, interfaces, exception handling, and threading. The course is affiliated with VTU and approved by AICTE, emphasizing practical programming skills in Java.

Uploaded by

dhanushree.c
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

lab program file java

The document outlines the syllabus for the Object Oriented Programming with Java course at Channabasaveshwara Institute Of Technology. It includes various programming experiments that students are expected to complete, covering topics such as matrix addition, stack operations, class design, polymorphism, abstract classes, interfaces, exception handling, and threading. The course is affiliated with VTU and approved by AICTE, emphasizing practical programming skills in Java.

Uploaded by

dhanushree.c
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Channabasaveshwara Institute Of Technology

Affiliated to VTU, Belagavi & Approved by AICTE, New-Delhi


(NAAC Accredited & ISO-9001:2015 Certified Institution)
NH 206,(B.H ROAD) GUBBI,TUMKUR – 572 216 Karnataka

DEPARTMENT OF ARTIFICIAL INTELLIGENCE & DATA SCIENCE

SYLLABUS

OBJECT ORIENTED PROGRAMMING WITH JAVA

SubCode:BCS306A CIE Marks:25

Hrs/week:02 Exam Hours:03

Programming Experiments (Suggested and are not limited to) OF IPCC


1. Develop a JAVA program to add TWO matrices of suitable order N (The value of N should be
read from command line arguments).
2. Develop a stack class to hold a maximum of 10 integers with suitable methods. Develop a
JAVA main method to illustrate Stack operations.
3. A class called Employee, which models an employee with an ID, name and salary, is designed
as shown inthe following class diagram. The method raiseSalary (percent) increases the salary by
the given percentage. Develop the Employee class and suitable main method for demonstration.
4. A class called MyPoint, which models a 2D point with x and y coordinates, is designed as
follows:
● Two instance variables x (int) and y (int).
● A default (or "no-arg") constructor that construct a point at the default location of (0, 0).
● A overloaded constructor that constructs a point with the given x and y coordinates.
● A method setXY() to set both x and y.
● A method getXY() which returns the x and y in a 2-element int array.
● A toString() method that returns a string description of the instance in the format "(x, y)".
● A method called distance(int x, int y) that returns the distance from this point to another point
at the
given (x, y) coordinates
● An overloaded distance(MyPoint another) that returns the distance from this point to the given
MyPoint instance (called another)
● Another overloaded distance() method that returns the distance from this point to the origin
(0,0)
Channabasaveshwara Institute Of Technology
Affiliated to VTU, Belagavi & Approved by AICTE, New-Delhi
(NAAC Accredited & ISO-9001:2015 Certified Institution)
NH 206,(B.H ROAD) GUBBI,TUMKUR – 572 216 Karnataka

Develop the code for the class MyPoint. Also develop a JAVA program (called TestMyPoint) to
test all the methods defined in the class.
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 ().
Demonstratepolymorphism 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.
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
8. Develop a JAVA program to create an outer class with a function display. Create another class
inside the outer class named inner with a function called display and call the two functions in the
main class.
9. Develop a JAVA program to raise a custom exception (user defined exception) for
DivisionByZero using try, catch, throw and finally.
10. Develop a JAVA program to create a package named mypack and import & implement it in a
suitable class.
11. Write a program to illustrate creation of threads using runnable class. (start method start each
of the newly created thread. Inside the run method there is sleep() for suspend the thread for 500
milliseconds).
12. Develop a program to create a class MyThread in this class a constructor, call the base class
constructor, using super and start the thread. The run method of the class starts after this. It can
be observed that both main thread and created child thread are executed concurrently.

HOD

You might also like