0% found this document useful (0 votes)
17 views5 pages

Program List

The document outlines a comprehensive laboratory course on Object-Oriented Programming using Java, structured over ten weeks. Each week consists of various programming assignments designed to teach fundamental concepts such as basic Java syntax, data types, classes, inheritance, interfaces, exception handling, multithreading, strings, event handling, applets, and JDBC. The assignments progressively build on each other, culminating in practical applications like a simple calculator and database operations.

Uploaded by

lluxury250
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)
17 views5 pages

Program List

The document outlines a comprehensive laboratory course on Object-Oriented Programming using Java, structured over ten weeks. Each week consists of various programming assignments designed to teach fundamental concepts such as basic Java syntax, data types, classes, inheritance, interfaces, exception handling, multithreading, strings, event handling, applets, and JDBC. The assignments progressively build on each other, culminating in practical applications like a simple calculator and database operations.

Uploaded by

lluxury250
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/ 5

MCA-114: Object-Oriented Programming using Java- Laboratory

Week 1 (To do some basic programs in JAVA)


Program 1: Write a Java program to display the message “This is my first java class”.
Execute this program through the command line using javac and java.

Program 2: Write a Java program to display the message “This is just a test”. Pass
these 5 strings as arguments in the main function while executing the program through
cmd.

Program 3: Write a Java Program to make a frequency count of words in a given text
entered by the user.

Program 4: Write a Java program that prompts the user for an integer and then prints
out all prime numbers up to that integer. (use Scanner class to read input).

Program 5: Write a Java program to multiply two given matrices.

Program 6: Write a Java program to find the Fibonacci series using recursive and non-
recursive functions.

Week 2 (To study Data types, Scope, and a lifetime of variables, operators,
expressions, and control statements)
Program 1: Write a Java program to identify the symbols of expression given by the
user is the operator or of which datatype.

Program 2: Write a Java program to make a class A in that class declare function add
perform addition through main.

Program 3: Write a Java program to print prime numbers from 1 to 50 using while &
do-while loops.

Program 4: Write a Java program to print the following structure using for loop.
*
**
***
****
*****
****
***
**
*

Program 5: Write a Java program to find the factorial of given number using command
line.

Program 6: Write a Java program to find the volume of the cuboid using this pointer.
Program 7: Write a Java program to swap the value of the speed of bikes by making
class bike using call by value and call by reference

Program 8: Write a Java program to find whether the number is palindrome or not
using recursion.

Program 9: Write a Java program to print all the substrings of the given string
“CODING”.

Week 3 (To study the Classes and Objects in OOPJ )


Program 1: Write a Java program to create a class Rectangle with data members length
and breadth. Create a method area () that finds the area of the rectangle. Use the
constructor(s) to assign value to data members. Use “this” in a parameterized
constructor.

Program 2: Print the sum, difference, and product of two complex numbers by creating
a class named 'Complex' with separate methods for each operation whose real and
imaginary parts are entered by the user.

Program 3: Write a Java program to create a class Box with data members length,
breadth, and height. Create multiple constructors to assign values to objects in different
ways. Use the overridden “equals” method to compare objects, if found equal then
display the objects using overridden to string method.

Week 4 (To study inheritance in Java)


Program 1: Write a Java program to identify the accessibility of a variable by means
of different access specifiers within and outside the package.

Program 2: Write an employee class Marketer to accompany the other employees.


Marketers make $50,000 ($10,000 more than general employees), and they have an
additional method named advertise that prints "Act now, while supplies last!" Use
the super keyword to interact with the Employee superclass as appropriate.

Program 3: Create a base class Person and two derived classes as Student and Teacher
with their constructors and methods. Assume the student to be in the same package as
that of Person and Teacher class to be in a different package.
The inheritance hierarchy would appear as follows:

a) Add methods “get” the instance variables in the Person class. These would
consist of: getName, getAge, getGender.
b) Add methods to “set” and “get” the instance variables in the Student class.
These would consist of: getIdNum, getGPA, setIdNum.
c) Write a Teacher class that extends the parent class Person.

Program 4: Describe abstract class called Shape which has three subclasses say
Triangle, Rectangle, Circle. Define one method area() in the abstract class and override
this area() in these three subclasses to calculate for specific object i.e. area() of Triangle
subclass should calculate area of triangle etc. Same should be for Rectangle and Circle.
Program 5: Assume that a bank maintains two kinds of accounts for its customers, one
called savings account and the other current account. The savings account provides
compound interest and withdrawal facilities but no cheque book facility. The current
account provides cheque book facility but no interest. Current account holders should
also maintain a minimum balance and if the balance falls below this level, a service
charge is imposed.
Create a class Account that stores customer name, account number and type of account.
From this derive the classes Curr-acct and Sav-acct to make them more specific to their
requirements. Include the necessary methods in order to achieve the following tasks:

. Accept deposit from a customer and update the balance.


. Display the balance.
. Compute and deposit interest.
. Permit withdrawal and update the balance.
. Check for the minimum balance, impose penalty, if necessary and update the
balance.

Week 5 (To study Interfaces and Exception Handling in Java)


Program 1: Write a Java program to compute the area of circle and rectangle using
Interfaces.

Program 2: Write a Java program that uses interface for the implementation of fixed-
size and dynamic-size stacks (for dynamic stack size should be redefined as per the
number of elements).

Program 3: Write a Java program for exception handling with


StringIndexOutOfBound exception.
● Create an object of the class having StringIndexOutOfBound exception
whenever an index is invoked of a string, which is not in the range.
● Each character of a string object is stored in a particular index starting from 0.
● To get a character present in a particular index of a string you can use a method
charAt(int) of java.lang.String where int argument is the index.

Program 4: An array is declared with 5 elements. Then the code tries to access the 6th
element of the array which throws an exception. Write the program for this.

Program 5: Write a suitable program for the following conditions:


a) A try block followed by multiple catch blocks
b) Catching multiple type of exceptions
c) Using throws/throw keywords
d) Using finally block
e) Using try-with-resources
f) User-defined exceptions
Week 6 (To study about Multi-Threading in Java)
Program 1: Suppose there are 5 workers who carry out work at the same time. Develop
a program that shows this scenario with the concept of multithreading.

Program 2: Write a Java program that creates three threads. The first thread displays
“Good Morning” every second, the second thread displays “Hello” every two seconds,
and the third thread displays “Welcome” every three seconds.

Program 3: Implement a class that checks whether a given number is prime using both
the Thread class and Runnable interface.

Program 4: Write a Java program that correctly implements the producer-consumer


problem using the concept of inter-thread communication.

Week 7 (To study Strings in Java)


Program 1: Write a Java program to find whether a given string is palindrome or not.

Program 2: Write a method that will remove given character from the String.

Program 3: Write a Java program for sorting a given list of names.

Program 4: Write a Java program that computes your initials from your full name and
displays them.

Program 5: An anagram is a word or a phrase made by transposing the letters of


another word or phrase; for example, "parliament" is an anagram of "partial men," and
"software" is an anagram of "swear oft." Write a program that figures out whether one
string is an anagram of another string. The program should ignore white space and
punctuation.

Week 8 (To study Event Handling & AWT in Java)


Program 1: Write a Java program that handles all mouse events and shows the event
name at the centre of the window when a mouse event is fired (Use Adapter classes). .

Program 2: Write a Java program for handling Key events.

Program 3: Write a java program that simulates a traffic light. The program lets the
user select one of three lights: Red, Yellow or Green with radio buttons. On selecting a
button an appropriate message with “STOP” or “READY” or ”GO” should appear
above the buttons in selected color. Initially, there is no message shown.

Week 9 (To study Applets in Java)


Program1: Write an applet to display a simple message on a colored background.

Program2: Write a Java application in which wherever the mouse will be clicked. it
keeps printing the coordinates of the clicked.
Program3: Write an applet to display a moving banner showing the status of it.

Program4: Write an applet to draw a simple and beautiful landscape.

Program5: WAP to play audio in applet with appropriate requirements of AWT


components.

Program6: WAP to have communication between two applets.

Program7: WAP to display clock in an applet.

Week 10 (To study Swing and JDBC in Java)

Program1: Write a java programs to find factorial of a number. user is allowed to enter
a number into the text field whose factorial is to be determined. On pressing the button
the value of the text field is firstly converted into integer and then processed to find its
factorial. The result will get display in another text field. (Hint: use swings)

Program2: Write a java program that works as a simple calculator. Use a Grid Layout
to arrange Buttons for digits and for the + - * % operations. Add a text field to display
the result.

Program3: Write a java program that connects to a database using JDBC and does add,
delete, modify and retrieve operations.

You might also like