Rajagiri School of Engineering & Technology, Kakkanad

Department of Computer Science and Engineering

Lab Cycle

CSL 203 Object Oriented Programming Lab

Week 1: Basic Programs I

  1. Write a Java program to find the area of a circle.
  2. Write a Java program to find the sum of digits of a number.
  3. Write a Java program to find whether a number is perfect or not.
  4. Write a Java program to find the reverse of n numbers (Use Multiple loops)

Week 2: Basic Programs II - Strings

  1. Write a Java program to find the frequency of a given character in a string.
  2. Write a Java program that checks whether a given string is a palindrome or not. (Ex : MALAYALAM is a palindrome.)

Week 3: Basic Programs III - Arrays

  1. Write a Java program to multiply two given matrices.
  2. Write a Java program to find the largest element in a matrix and its transpose.

Week 4: Object Oriented Programming Concepts

  1. Write a Java program which creates a class named ‘Employee’ having the following members: Name, Age, Phone number, Address, Salary. It also has a method named ‘Print-Salary()’ which prints the salary of the Employee. Two classes 'Officer' and ‘Manager’ inherits the ‘Employee’ class. The ‘Officer’ and ‘manager’ classes have data members ‘specialization’ and ‘department’ respectively. Now assign name, age, phone number, address and salary to an officer and a manager by making an object of both of these classes and print the same.
  2. Write a Java program to create an abstract class named Shape that contains an empty method named numberOfSides(). Provide three classes named Rectangle, Triangle and Hexagon such that each one of the classes extends the class Shape. Each one of the classes contain only the method numberOfSides() that shows the number of sides in the given geometrical structures

Week 5: File handling and Input-Output management

  1. Write a Java program that reads from a file and writes to file by handling all file related exceptions.
  2. Write a Java program that reads a line of integers, and then displays each integer, and the sum of all the integers (Use String Tokenizer class of java.util).

Week 6: Exception handling and multi-threading applications

  1. Write a Java program that shows the usage of try, catch, throws, finally.
  2. Write a Java program that shows thread synchronization.

Week 7: Graphics Programming

  1. Write a Java program that works as a simple calculator. Arrange buttons for digits and the + - * % operations properly. Add a text field to display the result. Handle any possible exceptions like divide by zero. Use Java Swing.
  2. Write a Java program that simulates a traffic light. The program lets the user select one of three lights: red, yellow, or green. When a radio button is selected, the light is turned on, and only one light can be on at a time. No light is on when the program starts.

Week 8: Data Structures-I

  1. Write a Java program for the following:
  1. Create a doubly linked list of elements.
  2. Delete a given element from the above list.
  3. Display the contents of the list after deletion.

Week 9: Data Structures-II

  1. Write a Java program that implements a Quick sort algorithm for sorting a list of names in ascending order.
  2. Write a Java program that implements a binary search algorithm.

Week 10: Database Connectivity

  1. Write a file Handling program to display all records from a table using JDBC