Sei sulla pagina 1di 7

K L Deemed to be University

Department of Computer Science & Engineering


Course Handout for 2/4 Year B.Tech PROGRAM
A.Y.2018-19, Odd Semester

Course Title : Object Oriented Programming


Course Code : 17 CS 2004
L-T-P-S Structure : 3-0-2-0
Credits :4
Pre-requisite : C Programming
Course Coordinator : Dr G Somasekhar
Team of Instructors : Mr V Deepak, Mr Niranjan Appaswamy, Mr P Nagesh, Mr N Naveen, Mrs D
Durga Bhavani, Ms B Revathi, Mr BN Shashank.
Teaching Associates : - NIL-

Course Objective:
Make student to know, understand and apply object oriented concepts to develop a lab based project through
java programming language.

Course Rationale:
The current programming trend of the software industry due to the size of the problems handled totally based
on object oriented concepts. Most of the programming languages follows object oriented /based principles. Therefore
it is essential every student of CSE must undergo these principles. This course titled “Object Oriented Programming”
is to make the student understand the principles of Object Oriented Programming and develop simple to complex
programs using Java. The concepts Object oriented Programming viz. Encapsulation, Polymorphism and Inheritance
using java will be covered in this course. The course also includes Packages & Interfaces, I/O streams, Exception
Handling. All the relevant programs will be demonstrated under notepad with JDK and also Integrated Development
Environment (IDE) using Net Beans. The students will also execute the programs in the class room through LTC and
in the laboratory.

COURSE OUTCOMES (COs):

Blooms
Course Outcome Taxonomy
CO No PO/PSO
(CO) Level
(BTL)
Understand basic Concepts of OOP, fundamentals of java and
PO3, PO5,
CO1 apply the concepts of classes and objects through Java Language. PSO2
1,3,5
Apply constructors, Overloading, parameter passing.
CO2 Apply access control, Inheritance, Strings. PO3, PO5,
3,5
PSO2
Apply Interfaces, Packages, Exception Handling, multi threading, PO3, PO5,
CO3 3,5
i/o. PSO2
CO4 Apply collection framework and event driven programming. PO3, PO5,
3,5
PSO2
CO5 (Only for Apply object oriented programming concepts to write programs PO7, PO9,
lab and Analyze requirements and design to implement lab based PO10, 4
components) project with SDLC in a group of students. PSO1
COURSE OUTCOME INDICATORS (COIs):

Course
Highest COI-1 COI-2 COI-3 COI-4 COI-5 COI-6
Outcom
BTL (BTL1) (BTL2) (BTL3) (BTL4) (BTL5) (BTL6)
e No.
Fundamentals of java
and apply the
concepts of classes
Understand Constructors,
and objects through
CO 1 basic Concepts Overloading,
Java Language.
of OOP parameter passing.
Apply constructors,
Overloading,
parameter

Access control,
CO 2 Strings
Inheritance

Exception
CO 3 Interfaces, Packages, Handling, multi
threading, i/o.

Collection Event driven


CO 4
framework and. programming

Fundamentals of java
Constructors,
and apply the
Overloading,
concepts of classes
parameter passing,
and objects through
Understand Strings,
Java Language. Event driven
CO5 basic Concepts Exception
Apply constructors, programming
of OOP Handling, multi
Overloading,
threading, i/o,
parameter , Access
Collection
control, Inheritance ,
framework and.
Interfaces, Packages,

PROGRAM OUTCOMES & PROGRAM SPECIFIC OUTCOMES (POs/PSOs)

PO Keyword
Program Outcome Description
No
Engineering An ability to apply knowledge of mathematics, science, engineering fundamentals and an
1 Knowledge engineering specialization for the solution of complex engineering problems in
Mechanical engineering
Problem An ability to identify, formulate, research literature, analyze complex engineering problems
2 Analysis in mechanical engineering using first principles of mathematics, natural sciences and
engineering sciences
Design/ An ability to design solutions for complex engineering problems and system component or
3 development processes that meet the specified needs considering public health & safety and cultural,
of solutions societal & environment
Conduct An ability to use research-based knowledge and research methods including design of
investigations experiments, analysis and interpretation of data and synthesis of the information to obtain
4
of complex solutions to Mechanical engineering problems
problems
Modern tool Ability to create, select and apply appropriate techniques, resources and modern engineering
5
usage activities, with an understanding of the limitations
The engineer Ability to apply reasoning informed by the contextual knowledge to assess societal, health,
6 and society safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice
Environment Ability to demonstrate the knowledge of engineering solutions, contemporary issues
7 and understanding their impacts on societal and environmental contexts, leading towards
sustainability sustainable development
PO Keyword
Program Outcome Description
No
Ethics An ability to apply ethical principles and commit to professional ethics and responsibilities
8
and norms of engineering practice
Individual and An ability to function effectively as an individual, and as a member or leader in diverse
9
team work teams and in multi-disciplinary settings
Communicatio Ability to communicate effectively oral, written reports and graphical forms on complex
10
n engineering activities
Project Ability to demonstrate knowledge and understanding of the engineering and management
11 management principles and apply those one’s own work, as a member and leader in team, to manage
and finance projects and in multi-disciplinary environments
Lifelong An ability to recognize the need for and having the preparation and ability to engage
12
learning independent and life-long learning in broadest context of technological change

SYLLABUS:

Introduction: Object-Oriented Programming, OOP Principles, Encapsulation, Inheritance and Polymorphism


Java as a OOPs & Internet Enabled language, The Byte code, Data types, Variables, Dynamic initialization, scope and
life time of variables, Arrays, Operators, Control statements, Type Conversion and Casting, Compiling and running of
simple Java program. Classes and Objects: Concepts of classes and objects, Declaring objects, Assigning Object
Reference Variables, Methods, Constructors, Access Control, Garbage Collection, Usage of static with data and
methods, usage of final with data, Overloading methods and constructors, parameter passing - call by value, recursion,
Nested classes. Inheritance: Inheritance Basics, member access rules, Usage of super key word, forms of inheritance,
Method Overriding, Abstract classes, Dynamic method dispatch, Using final with inheritance, String handling
functions. Packages and Interfaces: Packages, Classpath, Importing packages, differences between classes and
interfaces, Implementing & Applying interface. Exception Handling: Exception Handling fundamentals, multi
threaded programming, java input/output, collection framework and swing package based event driven
programming.

TEXT BOOKS:
1. Herbert Schildt, “The Complete Reference Java”, 7 th edition TMH.
2. Timothy A. Budd, “An Introduction to Object-Oriented Programming”, 3/e, Pearson, 2008.

REFERENCE BOOKS:
1. Jim Keogh, “The Complete Reference J2EE”, TMH, 2006.
2. Deitel & Deitel, “‘Java – How to program”, 6th edition, PHI, 2007
3. Cay.S.Horstmann and Gary Cornell “Core Java 2, Vol 1, Fundamentals”, Seventh Edition, Pearson Education.

WEB REFERNCES/MOOCS:
1. https://java.com/download (java software)
2. http://docs.oracle.com/javase/tutorial/java/TOC.html (material source)
3. http://www.tutorialspoint.com/java/ (material source)
4. www.javatpoint.com/corejava-interview-questions (interview questions source)

PRACTICAL COMPONENT
List of Experiments supposed to finish in Open Lab Sessions:
Lab
Session List of Experiments CO-Mapping
No
In Lab:
1. Write a Java Program to read different data type values form user by using Scanner
class and print the same.
1 CO1
2. Write a Java program that reads an unspecified number of integers, determines how
many positive and negative values have been read, and computes the total and average of
the input values (not counting zeros). Your program ends with the input 0. Display the
average as a floating-point number.
2 In Lab: CO1
1. Write a Java Program to demonstrate
a)Implicit Type Casting
b)Explicit Type Casting

2. Write a Java Program to find sum of elements in a given array


In Lab:
1. Write a Java Program to create an 'Employee' class with variables are used to store
first name, last name, annual salary, and number of dependents.
There are two methods; First method is to initialize the variables (first name, last name,
monthlysalary, and number of days present as parameters.). Second method to returns the
total salary based on no.of days present. Use classes and object scenario to solve this.

2. Write a Java program to find the maximum number of two integer values, two double
values and three double values by using method overloading mechanism.

3 Post Lab: CO1


1. Write a Java program to design a class named 'Rectangle', contains: two double data
fields named width and height that specify the width and height of the rectangle and one
string data field named color that specifies the color of a rectangle.
There are three methods; first method set the data values for all the three fields. second, a
method named getArea() that returns the area of this rectangle, third a method named
getPerimeter() that returns the perimeter.
Implement RectangleMain class, create minimum two objects of Rectangle to invoke all
the methods and print the result.

2. Write a Java program to demonstrate the call by value and call by reference.
In Lab:
1. Write a Java program to create a class named 'StudentData' with datamembers
stuID,stuName,stuAge; and get(), set() methods to access and assign values. The class
has two constructors which are:
a. no parameter
b. three parameter,
and assign the values by using 'this' keyword. Now create objects of the 'StudentData'
class having none and two parameter constructors, and print the result

2. Write a Java Program to invoke a Garbage Collector and call the finalize() method on
an object, and show that it ignores all the exceptions raised in the method and program
will terminate normally.

Post Lab:
4 CO2
1. Write a Java program to create a class named 'Rectangle' with two data members-
length and breadth and a method to claculate the area(). The class has three constructors
which are:
a. having no parameter - values of both length and breadth are assigned zero.
b. having two numbers as parameters - the two numbers are assigned as length and
breadth respectively.
c. having one number as parameter - both length and breadth are assigned that number.
Now, create objects of the 'Rectangle' class having none, one and two parameters and
print their areas.

2. Write a Java program to perform garbage collection by creating a class with the name
GarbageCollection and print the free memory in java virtual machine using gc() method
of RunTime class, also use getRunTime() method to get reference of current RunTime
object.
5 In Lab: CO2
1. Write a Java program to demonstrate usage of static keyword, with help of static
variables, static methods, and static block.

2. Write a Java program to demonstrate Nested/Inner classes concept, by creating an


outer class Outer and inner class Inner, and by creating a main class
NestedClassesDemo, create objets for Outer and inner to access fields and methods of
Outer and Inner classes.
Post Lab:
1. Write a Java program to demonstrate usage of final keyword

2. Write a Java program to demonstrate Nested/Inner classes concept, by creating


an outer class Car having data fields carName, carType, and getCarName() method; and
an inner class Engine having data field engineType, and setEngineType(),
getEngineType() methods. and access outer class members with inner class by 'this'
keyword. create CarMain class to complete the rest of the program.

In Lab:
1. Write a Java Program to create a class called Amphibian. From this, inherit a class
called Frog. Put appropriate methods in the base class. In main( ), create a Frog and
upcast it to Amphibian, and check that all the methods still work.
6 CO2
2. Write a Java program to demostrate method overriding by creating a class Dog, and
two sub classes of that Labrador & Yorkshire, create methods name() and bark() in
subclasses, use InheritanceDemo class to invoke methods by creating objects of those
subclasses.
In Lab:
1. Write a Java program to create abstract class Car, with instance variable regno, Car
constructor, concrete method fillTank(), abstract methods steering(int direction),
braking(int force).
Create two subclasses Maruthi and Santro to implements abstract methods in it. Create a
AbstractDemo class to for testing.
7 CO2
2. Write a java program to create an abstract class Shape with Data members: numSides;
Constructor: Shape() to initialize numSides; Concrete method: getNumSides(); Abstract
Methods: getArea(), getPerimeter()
Write a concrete subclass Rectangle with Data members: width, height
Write a concrete subclass RtTriangle with Data members: width, height
In another class, write a main method to define a Rectangle and a Triangle.
In Lab:
1. Write a Java program to demonstrate String class and its methods. Use length(),
indexOf(), toUpperCase(), toLowerCase(), equals(), equalsIgnoreCase(), compareTo(),
charAt(), replace(), trim() methods.

2. Write a java program to use append() method that concatenates the passed String
argument with the existing declared string. Use insert(), replace(), delete(), reverse()
methods of StringBuilder class to perform various operations on string.
8 CO2
Post Lab:
1. Write a Java program to demonstrate StringBuffer class and its methods. Use length(),
capacity(), append(), insert(), delete(), charAt() methods.

2. Write a java program to create StringBuilder class returns the current capacity of the
StringBuilder object. The default capacity of the Builder is 16. If the number of character
increases from its current capacity, it increases the capacity by (old_capacity*2)+2 e.g. at
current capacity 16, it becomes (16*2)+2=34.

In Lab:
1. Write a Java program to by creating a class with one private member variable and
declare two methods set() and print(). For set() set a value through the main method and
test with different access specifiers.
9 CO3
2. Write a Java program to create a class name Test, and take 3 variables declared as one
public, one private and one as default. By creating class named AcessTest define two
methods setc() and getc(), to pass the value through main method and check differences
between public, private and default access modifiers.
10 In Lab: CO3
1. Write a java program to create and access a user defined package where the package
contains a class named CircleDemo, which in turn contains a method called circleArea()
which takes radius of the circle as the parameter and returns the area of the circle.

2. Write a Java program to create a package for Book details giving bookName,
authorName, price and yearOfPublish, use that package in another program to perform
operation on the data.
In Lab:
1. Write a Java Program to define an Interface called "Vehicle" with abstract methods
changeGear(int), speedUp(int). You have to implement two classes "Car" and "Bike"
which define code for abstract methods of the Interface Vehicle.

2. Write a Java Program to demonstrate different types of arithmetic exceptions supposed


by java. Illustrate using an example, the use of arithmetic exceptions.

11 Post Lab: CO3


1. Write a Java program to Demonstrate STACK using Interface Concept. You need to
define an interface "StackInterface", abstract methods void push(int), int pop() and void
dispStack(). Define a class "MyStack" that implements the interface and write code to
push (), pop() and dispStack() methods

2. "The finally block will execute whether or not an exception is thrown”. Analyze the
meaning of this statement. Develop a java program to demonstrate finally.

In Lab:
1. Write a Java program to create a thread by extending Thread class. Define a job for
child thread to print a message “child thread” for 10 times. Define a job for main thread
to print a message “main thread” for 10 times. Create a class ThreadDemo define main
method in this class create child thread form this class.

2. Write a java program which contains an employee database having the fields like
name, number and basic salary for number of employees which has to be saved with the
file name called scores.txt.

12 Post Lab: CO4


1. Write a Java program to create a thread by implementing Runnable interface. Define a
job for child thread to print a message “child thread” for 10 times. Define a job for main
thread to print a message “main thread” for 10 times. Create a class ThreadDemo define
main method in this class create child thread form this class.

2. Write a java Program to Create a Student file which should contain fields like
regNo,name and Internal Marks , where all the details have to be entered through
keyboard. If a student id is not matched in contents of a file compiler has to generate a
message saying that wrong details entered.

In Lab:

1. Write a java Program that uses HashSet to remove duplicate values from array of
Strings. Use printNonDuplicates method which have to be called from constructor by
passing Collection argument. Construct HashSet to remove duplicates. Call Iterator
methods hasNext and next to access the Set elements and output their values.
13 CO4
2. Write a java program which uses HashMap and TreeMap . Create a HashMap which
should be assigned to map. User should able to enter a text in textarea at the top of the
window and should press GO button to invoke actionPerformed. Write methods
createMap and createOutput to store no.of occurences of each word and to create a string
with all the entries in the map.
14 In Lab: CO4
1.Write a Java Program to create a form with 3 buttons and
-> Set label for first button is RED
-> Set label for second button is GREEN
-> Set label for third button is BLUE
Then apply action for every button as shown below:
a) if we click RED button form background color also change to RED
b) if we click GREEN button then background change to GREEN
c) if we click BLUE button then background change to BLUE"

2. "Write a Java program to create a login form which contains


-> 2 labels for user name and password
-> 2 TextFields for username and password
-> 1 button for submit
and display username and password details in next page when we click the submit
button."

Potrebbero piacerti anche