ANNAMACHARYA UNIVERSITY
EXCELLENCE IN EDUCATION; SERVICE TO SOCIETY
(ESTD, UNDER AP PRIVATE UNIVERSITIES (ESTABLISHMENT AND REGULATION) ACT, 2016)
Title of the Course: Object Oriented Programming using Java Lab
Category: Professional Core Lab
Couse Code: 24ACSE32L
Year: II B. Tech
Semester: I Semester
AI& DS, AI&ML, CSE, CSE(AI), CSE(AIML),CSE(DS) and
Branch:
CSE(IOTCSBT)
Lecture Hours Tutorial Hours Practice Hours Credits
0 0 3 1.5
Course Objectives: This course will be able to
1. Understand fundamentals of programming such as variables, conditional and iterative execution,
methods.
2. Understand fundamentals of Object-Oriented Programming in Java, Including defining classes,
Invoking methods, using libraries.
3. Aware of the important topics and principles of software development.
4. Have the ability to write a computer program to solve specified problems.
5. Use the Java SDK environment to create, debug and run simple Java Programs.
Course Outcomes:
At the end of the course, the student will be able to
1. Design and implement the programs to demonstrate classes, objects and encapsulation.
2. Demonstrate and implement the principles of inheritance, polymorphism, constructor overloading,
and method overloading
3.Understanding the use of packages, creation of packages, importing the packages and the importance
of the collection of framework
4.Implementation of multithread programming, Thread Priority, Exception Handling and Creation of
own Exceptions.
5.Implement and demonstrate generic programming, lambda expressions and collection of framework.
Exercise 1 3
a) Write a program using classes and objects in java?
b) Write a Java program to calculate sum of 5 subjects and find percentage.
c) Write a Java program to convert temperature from Centigrade to Fahrenheit and Fahrenheit
to Centigrade
d) Write a Java program to perform the arithmetic operations using switch case statement
Exercise 2 3
a) Write a Java program to display all strong numbers between 1 to n.
b) Write a Java program to display Fibonacci series between 1 to n.
c) Write a Java program to find the factorial of a given number using recursion.
d) Write a Java program to find multiplication of two matrices.
e) Write a program to accept contents into an Integer Array and print the frequency of each
number in the order of their number of occurrences.
Exercise 3 3
a) Write a Java program to implement the access control.
b) Write a Java program to implement the method overloading.
c) Write a program to call default constructor first and then any other constructor in the class?
d) Create a class Box that uses a parameterized constructor to initialize the dimensions of a
box. The dimensions of the Box are width, height, depth. The class should have a
method that can return the volume of the box. Create an object of the Box class and
test the functionalities.
e) Create a new class called Calculator with the following methods:
A static method called powerInt(int num1,int num2) This method should return num1 to the
power num2. A static method called powerDouble(double num1,double num2). This method
should return num1 to the power num2. Invoke both the methods and test the functionality.
Also count the number of objects created
Exercise 4 3
a) Write a Java program to implement the method overriding.
b) Create a multilevel inheritance for classes vehicle, brand and cost. The vehicle class
determines the type of vehicle which is inherited by the class brand which determines the
brand of the vehicle. Brand class is inherited by cost class, which tells about the cost of
the vehicle. Create another class which calls the constructor of cost class and method that
displays the total vehicle information from the attributes available in the super classes.
c) Create an inheritance hierarchy of Figure_3D, Cylinder, Cone, Sphere etc. In the base
class provides methods that are common to all Figure_3Ds and override these in the derived
classes to perform different behaviors, depending on the specific type of Figure_3D. Create
an array of Figure_3D, fill it with different specific types of Figure_3Ds and call your
base class methods
Exercise 5 3
a) Design a package to contain the class Student that contains data members such as
name, roll number and another package contains the interface Sports which contains some
sports information. Import these two packages in a package called Report which process
both Student and Sport and give the report.
b) Write a Java program to implement the multiple inheritance using interfaces.
Exercise 6 3
a) Write a Java program to find whether the given string is palindrome or not.
b) Accept two strings from the user and determine if the strings are anagrams or not.
c) Accept an array of strings and display the number of vowels and consonants occurred in
each string.
d) Accept a String and a number n from user. Divide the given string into substrings each of
size n and sort them lexicographically
Exercise 7 3
a) Write a program that reads two numbers from the user to perform integer division into
Num1 and Num2 variables. The division of Num1 and Num2 is displayed if they are integers.
If Num1 or Num2 were not an integer, the program would throw a Number Format Exception.
If Num2 were Zero, the program would throw an Arithmetic Exception
b) Write a Java program to implement the nested try statement.
c) Write a Java program to implement the own exception class.
Exercise 8 3
a) Write a Java program for multi-thread implementation.
Note: First thread displays “Good Morning” every one second, the second thread displays
“Hello” every two seconds and the third thread displays “Welcome” every three seconds.
b) Write a Java program to use the isAlive() and join() methods.
c) Write a program to illustrate Thread synchronization.
d) Write a Java program to implement producer consumer problem using inter-thread
communication mechanism.
Exercise 9 3
a) Create a generic Stack class that can hold any type of object. Implement the following
methods: i) void push(T obj): pushes an object onto the top of the stack, ii) T pop():
removes and returns the object at the top of the stack iii) boolean isEmpty(): returns true if
the stack is empty, false otherwise
b) Create a generic class for sorting the elements of different data types.
c) Any two programs on Lambda expressions.
Exercise 10 3
a) Write a Java program to display the sum of all the integers of given line of integers using
StringTokenizer class.
b) Write a Java program to demonstrate the working of LinkedList collection class.
c) Write a Java program to create a PriorityQueue and add some elements to it. Then remove
the highest priority element from the PriorityQueue and print the remaining elements
Prescribed Text Books:
1. H.M.Dietel and P.J.Dietel, Java How to Program 6thEdition, Pearson Education/PHI
2. Y.DanielLiang,Introduction to Java programming, Pearson Education, 6thEdition.
3. Cay Horstmann,Big Java, 2ndedition, Wiley Student Edition, Wiley India Private Limited.
4. Herbert Schildt.Java. The complete reference, TMH. 9thEdition.
CO-PO Mapping:
Individual and team work
Conduct investigations of
The engineer and society
Project management and
Engineering Knowledge
Design/Development of
Modern tool usage
complex problems
Life-long learning
Problem Analysis
Environment and
Communication
sustainability
solutions
Course
finance
Ethics
PSO1
PSO2
PSO3
Outcomes
24ACSE32L-1 1 3 3 3 3 1 3 3 3 2
24ACSE32L -2 3 3 3 3 3 3 2
24ACSE32L-3 3 3 3 3 3 - 3 3 3 2
24ACSE32L-4 3 3 3 3 1 3 3 3 2
24ACSE32L-5 3 3 3 1 3 3 3 2