Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

index_practical

The document outlines a series of practical programming exercises focused on Object Oriented Programming using Java, categorized into nine practicals. Each practical includes tasks such as writing programs for mathematical equations, sorting algorithms, class inheritance, exception handling, multithreading, and GUI applications using Java FX. The exercises aim to enhance students' understanding of core programming concepts and their application in real-world scenarios.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

index_practical

The document outlines a series of practical programming exercises focused on Object Oriented Programming using Java, categorized into nine practicals. Each practical includes tasks such as writing programs for mathematical equations, sorting algorithms, class inheritance, exception handling, multithreading, and GUI applications using Java FX. The exercises aim to enhance students' understanding of core programming concepts and their application in real-world scenarios.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Subject : Object Oriented Programming - 1

Subject Code: 3140705

Sr No Practical Name Marks CO Date Sign


Practical -1
1 Write a Program that displays Welcome to Java, Learning Java
Now and Programming is fun.
2 Write a program that solves the following equation and displays
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=e x=ed-bf/ad-bc
cx+dy=f y=af-ec/ad-bc )
3 Write a program that reads a number in meters, converts it to
10 CO1
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.

5 Write a program that prompts the user to enter three integers


and display the integers in decreasing order.
Practical -2
1 Write a program for sorting an elements in array, and enter
elements by command line argument
2 write a program to implement growable stack
3 Write a program that prompts the user to enter a letter and 10 CO1
check whether a letter is a vowel or constant
4 Write a program for calculator to accept an expression as a string
in which the operands and operator are separated by spaces.For
ex: 3 + 4
Practical-3
1 Write a program to perform method overloading of area method
to find area of rectangle and square
2 Do above program using constructor overloading.
10 CO2
3 Create a class student with necessary properties, methods and
constructor. Overload a function name search in this class which
allows us to search student based on roll number, name and city.

Practical-4
1 write a program that create following : a inherited by b ,b
inherited by c and c is inherited by d. a has one variable b has
two and c has 3 variables. Use constructor and super to
initialized the variables of classes.
2 Write a Java program that combine several classes and interfaces
the abstract class robot has subclass name robotA, robotB,
robotC. Class robotA1 extends robotA. Class robotB1 and
robotB2 extends robotB. Class robotC1 extends robotC. The
locomotion interface declares three methods has forward ,
reverse and stop. It is implemented by class robotB and robotC. 10 CO2
The sound interface declares one method named beep and it is
implemented by robotA1,robotB1 and robotC. Defined all class
and implement interface as specified than invoked beep method
of all class object that are of type sound.

3 write a program that has abstract class dim which has a two
variable dim1,dim2. triangle and rectangle are subclass of dim.
implement dynamic method dispatch by creating reference of
dim.
Practical-5
1 Write a java program to find solution of quadratic equation. Take
care of divide by zero error and other arithmetic exceptions

2 Write a program in which main() call a(),a() call b(),b() call c(),c()
call d(),d() genarates ArrayIndexOutOfBoundException. c and d
catch throw the Exception. b() handle an Exception. Each method
contain finally.

3 Write a program to get value of radius through keyboard and


calculate area of circle. Take care of InputMismatchException

4 Write a program to create an array of 10 integers. Get value of


those 10 integers using console. Now ask for an index of array
through keyboard then divide the array into two from that index. 10 CO3
Take care of array index out of bound exception. Also handle
InputMismatchException
5 Create a class name student which stores information like roll
number, name, phone number, address, course etc. Write a
function which accepts an object of student to add a new
student in existing list of student. While adding check for roll
number. The roll number should be in 3 digit. Implement this
check using user define exception class

6 Write the bin2Dec (string binary String) method to convert a


binary string into a decimal number. Implement the bin2Dec
method to throw a NumberFormatException if the string is not a
binary string.

Practical -6
1 Write a Program for multithreading that finds prime number in
the range provided by user in command line argument
depending upon range creates sufficient number of child thread.

2 Write a program that demonstrate thread priority four threads


each with a different priority level then the other are started 10 CO3
objects and not the behave of each Thread

3 Write a program that demonstrate use of Executor Framework in


mutitasking.
4 Write a program for handling producer consumer problem.
Practical -7
1 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.
2 Evaluate expression using stack class
3 Demostrate test time and removed time required for hash
set,tree set,an array set,linked list
4 1). Using list perform following operation on it in java program.
(use ArrayList and LinkedList )
1. Creating a new list
2. Basic operations
3. Iterating over a list
4. Searching for an element in a list 10 CO4
5. Sorting a list
6. Copying one list into another
7. Shuffling elements in a list
8. Reversing elements in a list
9. Extracting a portion of a list
10. Converting between Lists and arrays
11. List to Stream
12. Concurrent lists.

5 Write a java program to evaluate arithmetic operation using


stack
6 Implement a java program to show various operation of queue

Practical-8
1 Implement singly linked list and its operations in java program

2 Define MYPriorityQueue class that extends Priority Queue to


implement the Cloneable interface and implement the clone()
method to clone a priority queue
3 Write a Java program to remove all occurrences of a specified
value in a given array of integers and return the new length of
the array.
Write a Java program to find the longest word in a text file. 10 CO4

4 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.
5 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
Practical-9/10
1 Implemet Following using Java FX
Write a program that moves a circle up, down, left or right using
arrow keys.
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 20 CO5
is released.
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.
2 Develop an simple java application which uses Java FX.

You might also like