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

Java Lab Manual 5 SEM

This document outlines a lab manual for a course on Object Oriented Programming-I. It lists 15 experiments to be completed over the course of the semester. Each experiment is scheduled for a specific lab session and includes 2-3 programming tasks or exercises related to Java programming concepts like arrays, classes, inheritance, exception handling, file I/O, generics, and data structures. The experiments increase in complexity over the course of the semester to build students' skills in OOP using Java.

Uploaded by

JAY PATEL
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views

Java Lab Manual 5 SEM

This document outlines a lab manual for a course on Object Oriented Programming-I. It lists 15 experiments to be completed over the course of the semester. Each experiment is scheduled for a specific lab session and includes 2-3 programming tasks or exercises related to Java programming concepts like arrays, classes, inheritance, exception handling, file I/O, generics, and data structures. The experiments increase in complexity over the course of the semester to build students' skills in OOP using Java.

Uploaded by

JAY PATEL
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

ADANI INSTITUTE OF INFRASTRUCTURE ENGINEERING

INFORMATION AND COMMUNICATION TECHNOLOGY

Subject: Object Oriented Programming -I Practical


(5th SEMESTER)

LAB MANUAL

S.NO List of Experiments Lab


Schedule
1) • Demonstrate the role of Role of JDK, JRE, JVM.
• Write a program to demonstrate basic datatypes and operators
LAB 1
in Java.
• Write a Program that displays Welcome to Java, Learning Java
Now and Programming is fun.

2) • Write a program to demonstrate array in java.


• Write a program to demonstrate classes and object in java
LAB 2
• Write a java program for Method overloading and Constructor
overloading.

3) • Program to demonstrate the inheritance in java.


• Write a program that solves the following equation and displays
LAB 3
the value x and y:
1) 3.4x+50.2y=44.5 2) 2.1x+.55y=5.9 (Assume Cramer’s rule to
solve equation
ax+by=ex=ed-bf/ad-bc
cx+dy=f y=af-ec/ad-bc )

• Write a program that reads a number in meters, converts it to feet,


and displays the result.

4) • Body Mass Index (BMI) is a measure of health on weight. It can


be calculated by taking your weight in kilograms and dividing by
the square of your height in meters. Write a program that prompts
the user to enter a weight in pounds and height in inches and
displays the BMI.
Note:- 1 pound=.45359237 Kg and 1 inch=.0254 meters. LAB 4
• Write a program that prompts the user to enter three integers and
display the integers in decreasing order.
• Write a program that prompts the user to enter a letter and check
whether a letter is a vowel or constant.

5) • Write a program that prompts the user to enter a letter and check
whether a letter is a vowel or constant.
• Assume a vehicle plate number consists of three uppercase letters
followed by four digits. Write a program to generate a plate LAB 5
number.
• Write a program that reads an integer and displays all its smallest
factors in increasing order. For example if input number is 120,
the output should be as follows:2,2,2,3,5.
6) • Write a method with following method header. public static int
gcd(intnum1,intnum2)
Write a program that prompts the user to enter two integers and
compute the gcd of two integers.
LAB 6
• Write a java program to display the employee details using
scanner class

7)

• Write a java program that checks whether a given string is


palindrome or not.
LAB 7
• Write a java program to represent Abstract class with example.
• Write a java program to implement Interface using extends
keyword.

8)

• Demonstrate the concept of exception handling in java


• Write a java program for creating multiple catch blocks Write a
LAB 8
java program to create user defined package.
9) • Write a test program that prompts the user to enter ten numbers,
invoke a method to reverse the numbers, display the numbers.
Write a program that creates a Random object with seed 1000
and displays the first 100 random integers between 1 and 49
using the NextInt (49) method.
• Write a program for calculator to accept an expression as a string LAB 9
in which the operands and operator are separated by zero or more
spaces.
For ex: 3+4 and 3 + 4 are acceptable expressions.

10)

• Write a program that creates an Array List and adds a Loan object
, a Date object , a string, and a Circle object to the list, and use a
loop to display all elements in the list by invoking the object’s to
String() method.
LAB 10
• Write the bin2Dec (string binary String) method to convert a
binary string into a decimal number. Implement the bin2Dec
method to throw a Number Format Exception if the string is not
a binary string.

11)

• Write a program that prompts the user to enter a decimal number


and displays the number in a fraction.
Hint: Read the decimal number as a string, extract the integer
part and fractional part from the string
LAB 11
• Write a program that displays a tic-tac-toe board. A cell may be
X, O, or empty. What to display at each cell is randomly decided.
The X and O are images in the files X.gif and O.gif.
• Write a program that moves a circle up, down, left or right using
arrow keys.

12)
• Write a program that displays the color of a circle as red when
the mouse button is pressed and as blue when the mouse button
is released.
LAB 12
• Write a GUI program that use button to move the message to the
left and right and use the radio button to change the color for the
message displayed.

13)

• Write a program to create a file name 123.txt, if it does not exist.


Append a new data to it if it already exist. write 150 integers
created randomly into the file using Text I/O. Integers are
separated by space. Write a recursive method that returns the
LAB 13
smallest integer in an array.
• Write a test program that prompts the user to enter an integer and
display its product.

14)

• Write a test program that prompts the user to enter an integer and
display its product.
LAB 14
• Write a generic method that returns the minimum elements in a
two dimensional array.
15)
• Define MY Priority Queue class that extends Priority Queue to
implement the Cloneable interface and implement the clone()
method to clone a priority queue.
LAB 15
• Write a program that reads words from a text file and displays all
the nonduplicate words in descending order. The text file is
passed as a command-line argument.

You might also like