KEMBAR78
Lab Demo Problem Statements | PDF | Class (Computer Programming) | Method (Computer Programming)
0% found this document useful (0 votes)
7 views2 pages

Lab Demo Problem Statements

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Lab Demo Problem Statements

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

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. A class called MyPoint, which models a 2D point with x and y coordinates, is designed as
follows:
a. Two instance variables x (int) and y (int).
b. A default (or “no-arg”) constructor that construct a point at the default location of
(0, 0).
c. A overloaded constructor that constructs a point with the given x and y
coordinates.
d. A method setXY() to set both x and y.
e. A method getXY() which returns the x and y in a 2-element int array.
f. A toString() method that returns a string description of the instance in the format
“(x, y)”.
g. A method called distance(int x, int y) that returns the distance from this point to
another point at the given (x, y) coordinates
h. An overloaded distance(MyPoint another) that returns the distance from this point
to the given MyPoint instance (called another)
i.Another overloaded distance() method that returns the distance from this point to the
origin (0,0) Develop the code for the class MyPoint. Also develop a JAVA program
(called TestMyPoint) to test all the methods defined in the class.

3. 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 raiseSalary (percent)
increases the salary by the given percentage. Develop the Employee class and suitable
main method for demonstration.

4. Develop a stack class to hold a maximum of 10 integers with suitable methods. Develop
a JAVA main method to illustrate Stack operations
5. Develop a JAVA program to create a package named mypack and import & implement it
in a suitable class
6. 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.
7. Develop a JAVA program to raise a custom exception (user defined exception) for
DivisionByZero using try, catch, throw and finally.
8. 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).
9. Thread program on factorial and Fibonacci
10. Create another class Book with data members – name, prize and Author (it is the object
of the above class). Assume that a Book would have only one author. Write a test driver
called TestBook to test all the public methods in the class Book. Take Note that you have
to construct an instance of Author before you can construct an instance of Book.
11. Develop a “Student Management System” application. Implement classes such as
Student, Course, and Department using encapsulation and inheritance. Use interfaces
like PersonActions for common methods. Include features like enrolling students,
assigning courses, and generating academic reports.
12. Create a “Shape Drawing Application” that demonstrates interface-based
polymorphism. Define an interface Shape with methods like draw() and calculateArea().
Implement different classes such as Circle, Rectangle, and Triangle. Use polymorphism to
handle multiple shape objects through a single interface reference.
13. Build a “Banking System” that performs operations like deposit, withdrawal, and fund
transfer. Implement custom exceptions such as InsufficientFundsExceptio n and
InvalidAmountException. Use try-catch-finally blocks to gracefully handle invalid
transactions and display user-friendly error messages.
14. Implement an “Inventory Management System” using Collections. Use ArrayList to store
products, HashMap for product lookup by ID, and TreeSet to sort products by price.
Include operations to add, delete, search, and display product information
15. Create a sample Registration page using servlet and JSP to get user information.

You might also like