0% found this document useful (0 votes)
35 views4 pages

CSL203 Java Lab Cycle Programs

java lab cylce s3 CS

Uploaded by

aflahmm351
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
35 views4 pages

CSL203 Java Lab Cycle Programs

java lab cylce s3 CS

Uploaded by

aflahmm351
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 4

CSL 203

OBJECT ORIENTED PROGRAMMING LAB (IN JAVA)


LAB CYCLES AND SCHEDULE

 Total 100 marks which will be converted out of 30 while calculating Internal
Evaluation marks.
 Half of the marks will be reduced for late completion of a program. The program will
not be evaluated if it was submitted later than 1 week from the date for submission,
without a valid reason.
 ** Mandatory Questions As Per Syllabus.

CYCLE 1 (14 marks)


Basic programs using data types, operators, and control statements in
Java.

1) Write a Java program to check whether a given number is prime or not. (2


marks) 2) Write a Java program that checks whether a given string is a
palindrome or not. Ex: MALAYALAM is palindrome. (2 marks)
3) Write a Java Program to find the frequency of a given character in a string. ** (2
marks) 4) Write a Java program to reverse an given string. (2 marks)
5) Write a Java program to find the second smallest element in an array. (2
marks) 6) Write a Java program to multiply two given matrices. ** (2 marks)
7) Write a Java program to display the transpose of a given matrix. (2
marks)

CYCLE 2 (15 marks)


Object Oriented Programming Concepts:
Problem on the use of constructors, inheritance, method overloading,
method overriding, polymorphism and garbage collection.

1) Write a Java program to calculate the area of different shapes namely circle,
rectangle, and triangle using the concept of method overloading. (2 marks)
2) Write a Java program which creates a class named 'Employee' having the
following mem bers: Name, Age, Phone number, Address, Salary. It also has a
method named 'printSalary( )' which prints the salary of the Employee. Two
classes 'Officer' and 'Man ager' inherits the 'Employee' class. The 'Officer' and
'Manager' classes have data members 'specialization' and 'department'
respectively. Now, assign name, age, phone number, ad dress and salary to an
officer and a manager by making an object of both of these classes and print the
same. (Exercise to understand inheritance). ** (3 marks)
3) Write two Java classes Employee and Engineer. Engineer should inherit from
Employee class. Employee class to have two methods display() and calcSalary().
Write a program to
display the engineer salary and to display from Employee class using a single
object in stantiation (i.e., only one object creation is allowed).
 display() only prints the name of the class and does not return any value. Ex. “
Name of class is Employee.”
 calcSalary() in Employee displays “Salary of employee is 10000” and
calcSalary() in Engineer displays “Salary of employee is 20000.” (3 marks)
4) 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 contains only the method numberOfSides(
) that shows the number of sides in the given geometrical structures. (Exercise to
understand polymorphism). ** (3 marks)
5) Write a Java program to illustrate Interface inheritance. (2 marks)
6) Write a Java program to demonstrate the use of garbage collector. (2 marks)

CYCLE 3 (17 marks)


Handling different types of files as well as input and output management
methods.

1) Write a file handling program in Java with reader/writer. (3 marks)


2) Write a Java program that reads a file and displays the file on the screen, with a
line num ber before each line. (3 marks)
3) Write a Java program that displays the number of characters, lines and words in a
text file. (3 marks)
4) Write a Java program that read from a file and write to file by handling all file
related ex ceptions. ** (4 marks)
5) 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). ** (4
marks)

CYCLE 4 (18 marks)


Exception handling and multi-threading applications.
1) Write a Java program that shows the usage of try, catch, throws and finally. ** (2
marks) 2) Write a Java program that shows how to create a user-defined exception. (2
marks) 3) Write a Java program that implements a multi-threaded program which has
three threads.
First thread generates a random integer every 1 second. If the value is even,
second thread computes the square of the number and prints. If the value is odd
the third thread will print the value of cube of the number. (4 marks)
4) Write a Java program that shows thread synchronization. ** (4 marks) 5) Write a
Java program to create two threads: One for displaying all odd number between 1
and 100 and second thread for displaying all even numbers between 1 and 100. (3
marks)
6) Write a Java program that shows thread priorities. (3 marks)

CYCLE 5 (24 marks)


Graphics Programming

1) Write a Java program that allows the user to draw lines, rectangles and ovals.
(2 marks) 2) Write a Java program for handling mouse events. (2 marks)
3) Write a Java program for handling key events using Adapter classes (general). (2
marks) 4) Write a Java Swing program to print a wave form on the output screen. (2
marks) 5) 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
possi ble exceptions like divide by zero. Use Java Swing. ** (5 marks)
6) 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.** (5 marks)
7) Write a Java program to display all records from a table using Java Database
Connectiv ity (JDBC). (3 marks)
8) Write a program to accept rollno, name, CGPA of “n” students and store the data
to a database using JDBC connectivity. Display the list of students having CGPA
greater than 7. (Use MySQL / Oracle database). (3 marks)

CYCLE 6 (12 marks)


Standard Searching and Sorting Algorithms using data structures and
algorithms learned from course Data Structures (CST 201)
1) Write a Java program for the following: **
A) Create a doubly linked list of elements.
B) Delete a given element from the above list.
C) Display the contents of the list after deletion. (3 marks)
2) Write a Java program that implements the binary search algorithm. (3 marks) 3)
Write a Java program that implements Quick Sort algorithm for sorting a list of
names in ascending order. ** (3 marks)
4) Write a Java program to implement Heap Sort algorithm using array. (3 marks)

You might also like