?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
Name : ______________________________________Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
Name : ______________________________________Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious andenterprising professionals conforming to global standards through value based quality education and
training.
? To provide competent technical manpower capable of meeting requirements of the
--- Content provided by FirstRanker.com ---
Industry? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
Name : ______________________________________Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious andenterprising professionals conforming to global standards through value based quality education and
training.
? To provide competent technical manpower capable of meeting requirements of the
--- Content provided by FirstRanker.com ---
Industry? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineeringthrough quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
Name : ______________________________________Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious andenterprising professionals conforming to global standards through value based quality education and
training.
? To provide competent technical manpower capable of meeting requirements of the
--- Content provided by FirstRanker.com ---
Industry? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineeringthrough quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
--- Content provided by FirstRanker.com ---
To impart students with fundamental knowledge in Mathematics, Science and fundamentals ofengineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
--- Content provided by FirstRanker.com ---
3. BREADTHTo provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
--- Content provided by FirstRanker.com ---
To bestow students with adequate training and provide opportunities to work as team that will buildup their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
--- Content provided by FirstRanker.com ---
and Engineering and to create awareness about the need for lifelong learning and pursuing advanceddegrees
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
--- Content provided by FirstRanker.com ---
Reg. No. : ______________________________________Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5is committed to provide highly disciplined, conscientious and
--- Content provided by FirstRanker.com ---
enterprising professionals conforming to global standards through value based quality education andtraining.
? To provide competent technical manpower capable of meeting requirements of the
Industry
--- Content provided by FirstRanker.com ---
? To contribute to the promotion of Academic Excellence in pursuit of TechnicalEducation at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
--- Content provided by FirstRanker.com ---
through quality education and to provide enthusiastic professionals with commitment? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
--- Content provided by FirstRanker.com ---
engineering that will mould them to be successful professionals2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
--- Content provided by FirstRanker.com ---
To provide relevant training and experience to bridge the gap between theory and practice whichenables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
--- Content provided by FirstRanker.com ---
up their communication skills, individual leadership and supportive qualities, and to enable them to adaptand work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
--- Content provided by FirstRanker.com ---
degrees--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
--- Content provided by FirstRanker.com ---
Computer Science and Engineering fieldb) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
--- Content provided by FirstRanker.com ---
e) To create, select and apply appropriate techniques, resources, modern engineering and IT toolsf) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
--- Content provided by FirstRanker.com ---
both verbal and written formsi) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
III SEMESTER - R 2017--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of theIndustry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
--- Content provided by FirstRanker.com ---
on heart and soul--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
--- Content provided by FirstRanker.com ---
1. FUNDAMENTALSTo impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
--- Content provided by FirstRanker.com ---
complex software problems in industry and to develop practical solutions for them3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
--- Content provided by FirstRanker.com ---
4. PROFESSIONAL SKILLSTo bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
--- Content provided by FirstRanker.com ---
To develop the ability of students to establish themselves as professionals in Computer Scienceand Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
PROGRAMME OUTCOMES (POs)
--- Content provided by FirstRanker.com ---
On completion of the B.E. (CSE) degree, the graduates will be ablea) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
--- Content provided by FirstRanker.com ---
c) To design and develop innovative and creative software applicationsd) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
--- Content provided by FirstRanker.com ---
environmental, social, political, ethical, safe and sustainableh) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
--- Content provided by FirstRanker.com ---
j) To engage in lifelong learning and exhibit their technical skillsk) To develop and manage projects in multidisciplinary environment
9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
--- Content provided by FirstRanker.com ---
following tariff.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 6 per unitIf the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 7 per unit2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVESFirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORYIII SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
--- Content provided by FirstRanker.com ---
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tagon heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGTo strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
.? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
--- Content provided by FirstRanker.com ---
To provide students with sound knowledge in engineering and experimental skills to identifycomplex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
--- Content provided by FirstRanker.com ---
requiring interdisciplinary skills4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
--- Content provided by FirstRanker.com ---
5. LIFELONG LEARNINGTo develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
--- Content provided by FirstRanker.com ---
careerc) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
--- Content provided by FirstRanker.com ---
g) To develop a system that will meet expected needs within realistic constraints such as economical,environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
--- Content provided by FirstRanker.com ---
coordinationj) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
--- Content provided by FirstRanker.com ---
(i.e domestic or commercial). Compute the bill amount using thefollowing tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 4 per unit? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 6 per unit? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES
10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
--- Content provided by FirstRanker.com ---
for staff club fund. Generate pay slips for the employees with their gross and net salary.4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
--- Content provided by FirstRanker.com ---
a. Append - add at endb. Insert ? add at particular index
c. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
--- Content provided by FirstRanker.com ---
integers and an empty method named print Area(). Provide three classes namedRectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
--- Content provided by FirstRanker.com ---
8. Write a Java program that reads a file name from the user, displays information aboutwhether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
--- Content provided by FirstRanker.com ---
thread computes the square of the number and prints. If the value is odd, the third threadwill print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
--- Content provided by FirstRanker.com ---
following options.FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORYIII SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
--- Content provided by FirstRanker.com ---
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tagon heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGTo strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
.? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
--- Content provided by FirstRanker.com ---
To provide students with sound knowledge in engineering and experimental skills to identifycomplex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
--- Content provided by FirstRanker.com ---
requiring interdisciplinary skills4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
--- Content provided by FirstRanker.com ---
5. LIFELONG LEARNINGTo develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
--- Content provided by FirstRanker.com ---
careerc) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
--- Content provided by FirstRanker.com ---
g) To develop a system that will meet expected needs within realistic constraints such as economical,environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
--- Content provided by FirstRanker.com ---
coordinationj) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
--- Content provided by FirstRanker.com ---
(i.e domestic or commercial). Compute the bill amount using thefollowing tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 4 per unit? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 6 per unit? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES
10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
--- Content provided by FirstRanker.com ---
for staff club fund. Generate pay slips for the employees with their gross and net salary.4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
--- Content provided by FirstRanker.com ---
a. Append - add at endb. Insert ? add at particular index
c. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
--- Content provided by FirstRanker.com ---
integers and an empty method named print Area(). Provide three classes namedRectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
--- Content provided by FirstRanker.com ---
8. Write a Java program that reads a file name from the user, displays information aboutwhether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
--- Content provided by FirstRanker.com ---
thread computes the square of the number and prints. If the value is odd, the third threadwill print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
--- Content provided by FirstRanker.com ---
following options.11
--- Content provided by FirstRanker.com ---
a) Decimal manipulationsb) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGCS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
--- Content provided by FirstRanker.com ---
Section : ______________________________________--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
--- Content provided by FirstRanker.com ---
training.? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
--- Content provided by FirstRanker.com ---
Education at different levels? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
--- Content provided by FirstRanker.com ---
2. CORE COMPETENCETo provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
--- Content provided by FirstRanker.com ---
enables them to find solutions for real time problems in industry and organization, and to design productsrequiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
--- Content provided by FirstRanker.com ---
and work in ever changing technologies5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
--- Content provided by FirstRanker.com ---
b) To design and conduct experiments as well as to analyze and interpret and apply the same in thecareer
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
--- Content provided by FirstRanker.com ---
f) To understand their roles as a professionals and give the best to the societyg) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
--- Content provided by FirstRanker.com ---
i) To work in a team as team member or a leader and make unique contributions and work withcoordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
--- Content provided by FirstRanker.com ---
and file processing.? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
--- Content provided by FirstRanker.com ---
Consumer no., consumer name, previous month reading, current month reading, type of EB connection(i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 2.50 per unit? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 4.50 per unit? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
--- Content provided by FirstRanker.com ---
(hours to minutes, seconds and vice versa) using packages.COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
103. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
--- Content provided by FirstRanker.com ---
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BPfor staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
--- Content provided by FirstRanker.com ---
for the followinga. Append - add at end
b. Insert ? add at particular index
c. Search
d. List all string starts with given letter
--- Content provided by FirstRanker.com ---
6. Write a Java Program to create an abstract class named Shape that contains twointegers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
--- Content provided by FirstRanker.com ---
7. Write a Java program to implement user defined exception handling.8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
--- Content provided by FirstRanker.com ---
First thread generates a random integer every 1 second and if the value is even, secondthread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
--- Content provided by FirstRanker.com ---
11. Design a calculator using event-driven programming paradigm of Java with thefollowing options.
11
--- Content provided by FirstRanker.com ---
a) Decimal manipulations
b) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
INDEXSl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
--- Content provided by FirstRanker.com ---
4 ADT Stack 195 String Operations 21
6 Abstract Class 23
7 Exception Handling 25
8 File Information 27
--- Content provided by FirstRanker.com ---
9 Multithreading 2910 Generic Function 31
11 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGCS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
--- Content provided by FirstRanker.com ---
Section : ______________________________________--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
--- Content provided by FirstRanker.com ---
training.? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
--- Content provided by FirstRanker.com ---
Education at different levels? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
--- Content provided by FirstRanker.com ---
2. CORE COMPETENCETo provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
--- Content provided by FirstRanker.com ---
enables them to find solutions for real time problems in industry and organization, and to design productsrequiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
--- Content provided by FirstRanker.com ---
and work in ever changing technologies5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
--- Content provided by FirstRanker.com ---
b) To design and conduct experiments as well as to analyze and interpret and apply the same in thecareer
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
--- Content provided by FirstRanker.com ---
f) To understand their roles as a professionals and give the best to the societyg) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
--- Content provided by FirstRanker.com ---
i) To work in a team as team member or a leader and make unique contributions and work withcoordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
--- Content provided by FirstRanker.com ---
and file processing.? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
--- Content provided by FirstRanker.com ---
Consumer no., consumer name, previous month reading, current month reading, type of EB connection(i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 2.50 per unit? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 4.50 per unit? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
--- Content provided by FirstRanker.com ---
(hours to minutes, seconds and vice versa) using packages.COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
103. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
--- Content provided by FirstRanker.com ---
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BPfor staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
--- Content provided by FirstRanker.com ---
for the followinga. Append - add at end
b. Insert ? add at particular index
c. Search
d. List all string starts with given letter
--- Content provided by FirstRanker.com ---
6. Write a Java Program to create an abstract class named Shape that contains twointegers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
--- Content provided by FirstRanker.com ---
7. Write a Java program to implement user defined exception handling.8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
--- Content provided by FirstRanker.com ---
First thread generates a random integer every 1 second and if the value is even, secondthread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
--- Content provided by FirstRanker.com ---
11. Design a calculator using event-driven programming paradigm of Java with thefollowing options.
11
--- Content provided by FirstRanker.com ---
a) Decimal manipulations
b) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
INDEXSl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
--- Content provided by FirstRanker.com ---
4 ADT Stack 195 String Operations 21
6 Abstract Class 23
7 Exception Handling 25
8 File Information 27
--- Content provided by FirstRanker.com ---
9 Multithreading 2910 Generic Function 31
11 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
--- Content provided by FirstRanker.com ---
Ex. No.:1
ELECTRICITY BILL GENERATION
Aim:
To develop a Java application to generate Electricity bill.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
--- Content provided by FirstRanker.com ---
previous month reading, current month reading, type of EB connection (i.e domestic orcommercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 4 per unit? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 6 per unit? > 501 units - Rs. 7 per unit
5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
III SEMESTER - R 2017--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of theIndustry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
--- Content provided by FirstRanker.com ---
on heart and soul--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
--- Content provided by FirstRanker.com ---
1. FUNDAMENTALSTo impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
--- Content provided by FirstRanker.com ---
complex software problems in industry and to develop practical solutions for them3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
--- Content provided by FirstRanker.com ---
4. PROFESSIONAL SKILLSTo bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
--- Content provided by FirstRanker.com ---
To develop the ability of students to establish themselves as professionals in Computer Scienceand Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
PROGRAMME OUTCOMES (POs)
--- Content provided by FirstRanker.com ---
On completion of the B.E. (CSE) degree, the graduates will be ablea) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
--- Content provided by FirstRanker.com ---
c) To design and develop innovative and creative software applicationsd) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
--- Content provided by FirstRanker.com ---
environmental, social, political, ethical, safe and sustainableh) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
--- Content provided by FirstRanker.com ---
j) To engage in lifelong learning and exhibit their technical skillsk) To develop and manage projects in multidisciplinary environment
9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
--- Content provided by FirstRanker.com ---
following tariff.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 6 per unitIf the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 7 per unit2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_noas members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
4. Design a Java interface for ADT Stack. Implement this interface using array. Providenecessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
--- Content provided by FirstRanker.com ---
b. Insert ? add at particular indexc. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
--- Content provided by FirstRanker.com ---
Rectangle, Triangle and Circle such that each one of the classes extends the classShape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
--- Content provided by FirstRanker.com ---
whether the file exists, whether the file is readable, or writable, the type of file and thelength of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
--- Content provided by FirstRanker.com ---
will print the value of cube of the number.10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
--- Content provided by FirstRanker.com ---
b) Scientific manipulations12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
--- Content provided by FirstRanker.com ---
1 Electricity Bill Generation 132 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
--- Content provided by FirstRanker.com ---
6 Abstract Class 237 Exception Handling 25
8 File Information 27
9 Multithreading 29
10 Generic Function 31
--- Content provided by FirstRanker.com ---
11 Calculator 3312 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
--- Content provided by FirstRanker.com ---
ELECTRICITY BILL GENERATIONAim:
To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
--- Content provided by FirstRanker.com ---
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
--- Content provided by FirstRanker.com ---
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application usingJava.
Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
--- Content provided by FirstRanker.com ---
Reg. No. : ______________________________________Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5is committed to provide highly disciplined, conscientious and
--- Content provided by FirstRanker.com ---
enterprising professionals conforming to global standards through value based quality education andtraining.
? To provide competent technical manpower capable of meeting requirements of the
Industry
--- Content provided by FirstRanker.com ---
? To contribute to the promotion of Academic Excellence in pursuit of TechnicalEducation at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
--- Content provided by FirstRanker.com ---
through quality education and to provide enthusiastic professionals with commitment? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
--- Content provided by FirstRanker.com ---
engineering that will mould them to be successful professionals2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
--- Content provided by FirstRanker.com ---
To provide relevant training and experience to bridge the gap between theory and practice whichenables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
--- Content provided by FirstRanker.com ---
up their communication skills, individual leadership and supportive qualities, and to enable them to adaptand work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
--- Content provided by FirstRanker.com ---
degrees--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
--- Content provided by FirstRanker.com ---
Computer Science and Engineering fieldb) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
--- Content provided by FirstRanker.com ---
e) To create, select and apply appropriate techniques, resources, modern engineering and IT toolsf) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
--- Content provided by FirstRanker.com ---
both verbal and written formsi) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9
CS8383 ?OBJECT ORIENTED LABORATORY
--- Content provided by FirstRanker.com ---
SYLLABUS? To build software development skills using java programming for real-world applications.
--- Content provided by FirstRanker.com ---
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handlingand file processing.
? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
--- Content provided by FirstRanker.com ---
1. Develop a Java application to generate Electricity bill. Create a class with the following members:Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 1 per unit? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 2 per unit? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
--- Content provided by FirstRanker.com ---
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter(hours to minutes, seconds and vice versa) using packages.
COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
10
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
--- Content provided by FirstRanker.com ---
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP asDA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
--- Content provided by FirstRanker.com ---
5. Write a program to perform string operations using ArrayList. Write functionsfor the following
a. Append - add at end
b. Insert ? add at particular index
c. Search
--- Content provided by FirstRanker.com ---
d. List all string starts with given letter6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
--- Content provided by FirstRanker.com ---
area of the given shape.7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
--- Content provided by FirstRanker.com ---
9. Write a java program that implements a multi-threaded application that has three threads.First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
--- Content provided by FirstRanker.com ---
generic function.11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11a) Decimal manipulations
b) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORYINDEX
Sl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
--- Content provided by FirstRanker.com ---
3 Payroll Processing 184 ADT Stack 19
5 String Operations 21
6 Abstract Class 23
7 Exception Handling 25
--- Content provided by FirstRanker.com ---
8 File Information 279 Multithreading 29
10 Generic Function 31
11 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13Ex. No.:1
ELECTRICITY BILL GENERATION
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application to generate Electricity bill.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create consumer class with the following members: Consumer no., consumer name,previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs.2.50 per unit? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 4.50 per unit? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
5. Print the amount
--- Content provided by FirstRanker.com ---
6. Stop the program14
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
--- Content provided by FirstRanker.com ---
Applications :(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
--- Content provided by FirstRanker.com ---
Ex. No.:2Currency Converter, Distance Converter and Time Converter
Aim:
To develop a Java application to implement currency converter , distance converter and time converter
--- Content provided by FirstRanker.com ---
using packages.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create three packages for currency converter , distance converter and time converter.3. Create corresponding code for conversion
4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORYIII SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
--- Content provided by FirstRanker.com ---
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tagon heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGTo strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
.? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
--- Content provided by FirstRanker.com ---
To provide students with sound knowledge in engineering and experimental skills to identifycomplex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
--- Content provided by FirstRanker.com ---
requiring interdisciplinary skills4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
--- Content provided by FirstRanker.com ---
5. LIFELONG LEARNINGTo develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
--- Content provided by FirstRanker.com ---
careerc) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
--- Content provided by FirstRanker.com ---
g) To develop a system that will meet expected needs within realistic constraints such as economical,environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
--- Content provided by FirstRanker.com ---
coordinationj) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
--- Content provided by FirstRanker.com ---
(i.e domestic or commercial). Compute the bill amount using thefollowing tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 4 per unit? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 6 per unit? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES
10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
--- Content provided by FirstRanker.com ---
for staff club fund. Generate pay slips for the employees with their gross and net salary.4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
--- Content provided by FirstRanker.com ---
a. Append - add at endb. Insert ? add at particular index
c. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
--- Content provided by FirstRanker.com ---
integers and an empty method named print Area(). Provide three classes namedRectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
--- Content provided by FirstRanker.com ---
8. Write a Java program that reads a file name from the user, displays information aboutwhether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
--- Content provided by FirstRanker.com ---
thread computes the square of the number and prints. If the value is odd, the third threadwill print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
--- Content provided by FirstRanker.com ---
following options.11
--- Content provided by FirstRanker.com ---
a) Decimal manipulationsb) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
--- Content provided by FirstRanker.com ---
Sl. No. Name of the Experiment Page No.1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
4 ADT Stack 19
--- Content provided by FirstRanker.com ---
5 String Operations 216 Abstract Class 23
7 Exception Handling 25
8 File Information 27
9 Multithreading 29
--- Content provided by FirstRanker.com ---
10 Generic Function 3111 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
--- Content provided by FirstRanker.com ---
Ex. No.:1ELECTRICITY BILL GENERATION
Aim:
To develop a Java application to generate Electricity bill.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
--- Content provided by FirstRanker.com ---
commercial).3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs.6 per unit4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 7 per unit5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Electricity Bill Java application was successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
Applications :
(1) Payroll Processing
--- Content provided by FirstRanker.com ---
(2) PF Calculation--- Content provided by FirstRanker.com ---
15
Ex. No.:2
--- Content provided by FirstRanker.com ---
Currency Converter, Distance Converter and Time ConverterAim:
To develop a Java application to implement currency converter , distance converter and time converter
using packages.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
--- Content provided by FirstRanker.com ---
4. Print the converted value.5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.Applications :
(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGCS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
--- Content provided by FirstRanker.com ---
Section : ______________________________________--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
--- Content provided by FirstRanker.com ---
training.? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
--- Content provided by FirstRanker.com ---
Education at different levels? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
--- Content provided by FirstRanker.com ---
2. CORE COMPETENCETo provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
--- Content provided by FirstRanker.com ---
enables them to find solutions for real time problems in industry and organization, and to design productsrequiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
--- Content provided by FirstRanker.com ---
and work in ever changing technologies5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
--- Content provided by FirstRanker.com ---
b) To design and conduct experiments as well as to analyze and interpret and apply the same in thecareer
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
--- Content provided by FirstRanker.com ---
f) To understand their roles as a professionals and give the best to the societyg) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
--- Content provided by FirstRanker.com ---
i) To work in a team as team member or a leader and make unique contributions and work withcoordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
--- Content provided by FirstRanker.com ---
and file processing.? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
--- Content provided by FirstRanker.com ---
Consumer no., consumer name, previous month reading, current month reading, type of EB connection(i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 2.50 per unit? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 4.50 per unit? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
--- Content provided by FirstRanker.com ---
(hours to minutes, seconds and vice versa) using packages.COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
103. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
--- Content provided by FirstRanker.com ---
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BPfor staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
--- Content provided by FirstRanker.com ---
for the followinga. Append - add at end
b. Insert ? add at particular index
c. Search
d. List all string starts with given letter
--- Content provided by FirstRanker.com ---
6. Write a Java Program to create an abstract class named Shape that contains twointegers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
--- Content provided by FirstRanker.com ---
7. Write a Java program to implement user defined exception handling.8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
--- Content provided by FirstRanker.com ---
First thread generates a random integer every 1 second and if the value is even, secondthread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
--- Content provided by FirstRanker.com ---
11. Design a calculator using event-driven programming paradigm of Java with thefollowing options.
11
--- Content provided by FirstRanker.com ---
a) Decimal manipulations
b) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
INDEXSl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
--- Content provided by FirstRanker.com ---
4 ADT Stack 195 String Operations 21
6 Abstract Class 23
7 Exception Handling 25
8 File Information 27
--- Content provided by FirstRanker.com ---
9 Multithreading 2910 Generic Function 31
11 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
--- Content provided by FirstRanker.com ---
Ex. No.:1
ELECTRICITY BILL GENERATION
Aim:
To develop a Java application to generate Electricity bill.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
--- Content provided by FirstRanker.com ---
previous month reading, current month reading, type of EB connection (i.e domestic orcommercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 4 per unit? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 6 per unit? > 501 units - Rs. 7 per unit
5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Electricity Bill Java application was successfully executed.Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Payroll Processing(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
Ex. No.:2
--- Content provided by FirstRanker.com ---
Currency Converter, Distance Converter and Time Converter
Aim:
To develop a Java application to implement currency converter , distance converter and time converter
using packages.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
--- Content provided by FirstRanker.com ---
3. Create corresponding code for conversion4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
17Ex. No.:3
PAYROLL PROCESSING
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application with employee class and generate pay slips for the employees with theirgross and net salary.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
members.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
--- Content provided by FirstRanker.com ---
from employee class.4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
Name : ______________________________________Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious andenterprising professionals conforming to global standards through value based quality education and
training.
? To provide competent technical manpower capable of meeting requirements of the
--- Content provided by FirstRanker.com ---
Industry? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineeringthrough quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
--- Content provided by FirstRanker.com ---
To impart students with fundamental knowledge in Mathematics, Science and fundamentals ofengineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
--- Content provided by FirstRanker.com ---
3. BREADTHTo provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
--- Content provided by FirstRanker.com ---
To bestow students with adequate training and provide opportunities to work as team that will buildup their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
--- Content provided by FirstRanker.com ---
and Engineering and to create awareness about the need for lifelong learning and pursuing advanceddegrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
--- Content provided by FirstRanker.com ---
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals inComputer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
--- Content provided by FirstRanker.com ---
d) To understand a complex real world problem and develop an efficient practical solutione) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
--- Content provided by FirstRanker.com ---
h) To communicate effectively and make others understand exactly what they are trying to convey inboth verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
--- Content provided by FirstRanker.com ---
k) To develop and manage projects in multidisciplinary environment9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORYSYLLABUS
? To build software development skills using java programming for real-world applications.
--- Content provided by FirstRanker.com ---
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
? To develop applications using generic programming and event handling.
--- Content provided by FirstRanker.com ---
LIST OF EXPERIMENTS:1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
following tariff.
--- Content provided by FirstRanker.com ---
If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INRand vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
10
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
--- Content provided by FirstRanker.com ---
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professorfrom employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
--- Content provided by FirstRanker.com ---
necessary exception handling in both the implementations.5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
b. Insert ? add at particular index
--- Content provided by FirstRanker.com ---
c. Searchd. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
--- Content provided by FirstRanker.com ---
Shape. Each one of the classes contains only the method print Area () that prints thearea of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
--- Content provided by FirstRanker.com ---
length of the file in bytes.9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
--- Content provided by FirstRanker.com ---
10. Write a java program to find the maximum value from the given type of elements using ageneric function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
b) Scientific manipulations
--- Content provided by FirstRanker.com ---
12. Develop a mini project for any application using Java concepts.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
--- Content provided by FirstRanker.com ---
2 Currency converter , Distance converter and Time converter 153 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
6 Abstract Class 23
--- Content provided by FirstRanker.com ---
7 Exception Handling 258 File Information 27
9 Multithreading 29
10 Generic Function 31
11 Calculator 33
--- Content provided by FirstRanker.com ---
12 Mini Project ? Vehicle Management System 36--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
ELECTRICITY BILL GENERATION
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs.1 per unit? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 2 per unit? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount6. Stop the program
14
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
--- Content provided by FirstRanker.com ---
Java.Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
--- Content provided by FirstRanker.com ---
Ex. No.:2
Currency Converter, Distance Converter and Time Converter
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application to implement currency converter , distance converter and time converterusing packages.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created for currency conversion, distance conversion and timeconversion and it was successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Kilogram to gram conversion(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
Ex. No.:3
--- Content provided by FirstRanker.com ---
PAYROLL PROCESSINGAim:
To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
--- Content provided by FirstRanker.com ---
members.3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
--- Content provided by FirstRanker.com ---
5. Generate pay slips for the employees with their gross and net salary.6. Stop the program
--- Content provided by FirstRanker.com ---
18
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Java application has been created with with employee class and pay slips are generated for
--- Content provided by FirstRanker.com ---
the employees with their gross and net salary.Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) EB Bill Generation(2) Income Tax Calculation
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
Name : ______________________________________Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious andenterprising professionals conforming to global standards through value based quality education and
training.
? To provide competent technical manpower capable of meeting requirements of the
--- Content provided by FirstRanker.com ---
Industry? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineeringthrough quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
--- Content provided by FirstRanker.com ---
To impart students with fundamental knowledge in Mathematics, Science and fundamentals ofengineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
--- Content provided by FirstRanker.com ---
3. BREADTHTo provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
--- Content provided by FirstRanker.com ---
To bestow students with adequate training and provide opportunities to work as team that will buildup their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
--- Content provided by FirstRanker.com ---
and Engineering and to create awareness about the need for lifelong learning and pursuing advanceddegrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
--- Content provided by FirstRanker.com ---
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals inComputer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
--- Content provided by FirstRanker.com ---
d) To understand a complex real world problem and develop an efficient practical solutione) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
--- Content provided by FirstRanker.com ---
h) To communicate effectively and make others understand exactly what they are trying to convey inboth verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
--- Content provided by FirstRanker.com ---
k) To develop and manage projects in multidisciplinary environment9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORYSYLLABUS
? To build software development skills using java programming for real-world applications.
--- Content provided by FirstRanker.com ---
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
? To develop applications using generic programming and event handling.
--- Content provided by FirstRanker.com ---
LIST OF EXPERIMENTS:1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
following tariff.
--- Content provided by FirstRanker.com ---
If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INRand vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
10
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
--- Content provided by FirstRanker.com ---
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professorfrom employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
--- Content provided by FirstRanker.com ---
necessary exception handling in both the implementations.5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
b. Insert ? add at particular index
--- Content provided by FirstRanker.com ---
c. Searchd. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
--- Content provided by FirstRanker.com ---
Shape. Each one of the classes contains only the method print Area () that prints thearea of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
--- Content provided by FirstRanker.com ---
length of the file in bytes.9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
--- Content provided by FirstRanker.com ---
10. Write a java program to find the maximum value from the given type of elements using ageneric function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
b) Scientific manipulations
--- Content provided by FirstRanker.com ---
12. Develop a mini project for any application using Java concepts.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
--- Content provided by FirstRanker.com ---
2 Currency converter , Distance converter and Time converter 153 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
6 Abstract Class 23
--- Content provided by FirstRanker.com ---
7 Exception Handling 258 File Information 27
9 Multithreading 29
10 Generic Function 31
11 Calculator 33
--- Content provided by FirstRanker.com ---
12 Mini Project ? Vehicle Management System 36--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
ELECTRICITY BILL GENERATION
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs.1 per unit? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 2 per unit? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount6. Stop the program
14
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
--- Content provided by FirstRanker.com ---
Java.Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
--- Content provided by FirstRanker.com ---
Ex. No.:2
Currency Converter, Distance Converter and Time Converter
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application to implement currency converter , distance converter and time converterusing packages.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created for currency conversion, distance conversion and timeconversion and it was successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Kilogram to gram conversion(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
Ex. No.:3
--- Content provided by FirstRanker.com ---
PAYROLL PROCESSINGAim:
To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
--- Content provided by FirstRanker.com ---
members.3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
--- Content provided by FirstRanker.com ---
5. Generate pay slips for the employees with their gross and net salary.6. Stop the program
--- Content provided by FirstRanker.com ---
18
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Java application has been created with with employee class and pay slips are generated for
--- Content provided by FirstRanker.com ---
the employees with their gross and net salary.Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) EB Bill Generation(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
Ex. No.:4
ADT STACK
--- Content provided by FirstRanker.com ---
AimTo design a Java interface for ADT Stack using array.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Define the interface.
3. Read the elements using array.
4. Initialize stackTop pointer as zero,
--- Content provided by FirstRanker.com ---
5. Define and use the method Push() to insert the elements into the stack with ?STACKOVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORYIII SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
--- Content provided by FirstRanker.com ---
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tagon heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGTo strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
.? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
--- Content provided by FirstRanker.com ---
To provide students with sound knowledge in engineering and experimental skills to identifycomplex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
--- Content provided by FirstRanker.com ---
requiring interdisciplinary skills4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
--- Content provided by FirstRanker.com ---
5. LIFELONG LEARNINGTo develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
--- Content provided by FirstRanker.com ---
careerc) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
--- Content provided by FirstRanker.com ---
g) To develop a system that will meet expected needs within realistic constraints such as economical,environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
--- Content provided by FirstRanker.com ---
coordinationj) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
--- Content provided by FirstRanker.com ---
(i.e domestic or commercial). Compute the bill amount using thefollowing tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 4 per unit? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 6 per unit? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES
10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
--- Content provided by FirstRanker.com ---
for staff club fund. Generate pay slips for the employees with their gross and net salary.4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
--- Content provided by FirstRanker.com ---
a. Append - add at endb. Insert ? add at particular index
c. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
--- Content provided by FirstRanker.com ---
integers and an empty method named print Area(). Provide three classes namedRectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
--- Content provided by FirstRanker.com ---
8. Write a Java program that reads a file name from the user, displays information aboutwhether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
--- Content provided by FirstRanker.com ---
thread computes the square of the number and prints. If the value is odd, the third threadwill print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
--- Content provided by FirstRanker.com ---
following options.11
--- Content provided by FirstRanker.com ---
a) Decimal manipulationsb) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
--- Content provided by FirstRanker.com ---
Sl. No. Name of the Experiment Page No.1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
4 ADT Stack 19
--- Content provided by FirstRanker.com ---
5 String Operations 216 Abstract Class 23
7 Exception Handling 25
8 File Information 27
9 Multithreading 29
--- Content provided by FirstRanker.com ---
10 Generic Function 3111 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
--- Content provided by FirstRanker.com ---
Ex. No.:1ELECTRICITY BILL GENERATION
Aim:
To develop a Java application to generate Electricity bill.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
--- Content provided by FirstRanker.com ---
commercial).3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs.6 per unit4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 7 per unit5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Electricity Bill Java application was successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
Applications :
(1) Payroll Processing
--- Content provided by FirstRanker.com ---
(2) PF Calculation--- Content provided by FirstRanker.com ---
15
Ex. No.:2
--- Content provided by FirstRanker.com ---
Currency Converter, Distance Converter and Time ConverterAim:
To develop a Java application to implement currency converter , distance converter and time converter
using packages.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
--- Content provided by FirstRanker.com ---
4. Print the converted value.5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.Applications :
(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
--- Content provided by FirstRanker.com ---
Ex. No.:3
PAYROLL PROCESSING
Aim:
To develop a Java application with employee class and generate pay slips for the employees with their
--- Content provided by FirstRanker.com ---
gross and net salary.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
members.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
--- Content provided by FirstRanker.com ---
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
18Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Java application has been created with with employee class and pay slips are generated for
the employees with their gross and net salary.
Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
--- Content provided by FirstRanker.com ---
generate Payroll Processing application using Java.Applications:
(1) EB Bill Generation
(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
--- Content provided by FirstRanker.com ---
Ex. No.:4ADT STACK
Aim
To design a Java interface for ADT Stack using array.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Define the interface.
--- Content provided by FirstRanker.com ---
3. Read the elements using array.4. Initialize stackTop pointer as zero,
5. Define and use the method Push() to insert the elements into the stack with ?STACK
OVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
--- Content provided by FirstRanker.com ---
UNDERFLOW? condition7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the design and implementation of ADT Stack using array has successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
--- Content provided by FirstRanker.com ---
Applications:
(1) ADT Queue
(2) ADT circular queue
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGCS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
--- Content provided by FirstRanker.com ---
Section : ______________________________________--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
--- Content provided by FirstRanker.com ---
training.? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
--- Content provided by FirstRanker.com ---
Education at different levels? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
--- Content provided by FirstRanker.com ---
2. CORE COMPETENCETo provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
--- Content provided by FirstRanker.com ---
enables them to find solutions for real time problems in industry and organization, and to design productsrequiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
--- Content provided by FirstRanker.com ---
and work in ever changing technologies5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
--- Content provided by FirstRanker.com ---
b) To design and conduct experiments as well as to analyze and interpret and apply the same in thecareer
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
--- Content provided by FirstRanker.com ---
f) To understand their roles as a professionals and give the best to the societyg) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
--- Content provided by FirstRanker.com ---
i) To work in a team as team member or a leader and make unique contributions and work withcoordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
--- Content provided by FirstRanker.com ---
and file processing.? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
--- Content provided by FirstRanker.com ---
Consumer no., consumer name, previous month reading, current month reading, type of EB connection(i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 2.50 per unit? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 4.50 per unit? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
--- Content provided by FirstRanker.com ---
(hours to minutes, seconds and vice versa) using packages.COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
103. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
--- Content provided by FirstRanker.com ---
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BPfor staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
--- Content provided by FirstRanker.com ---
for the followinga. Append - add at end
b. Insert ? add at particular index
c. Search
d. List all string starts with given letter
--- Content provided by FirstRanker.com ---
6. Write a Java Program to create an abstract class named Shape that contains twointegers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
--- Content provided by FirstRanker.com ---
7. Write a Java program to implement user defined exception handling.8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
--- Content provided by FirstRanker.com ---
First thread generates a random integer every 1 second and if the value is even, secondthread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
--- Content provided by FirstRanker.com ---
11. Design a calculator using event-driven programming paradigm of Java with thefollowing options.
11
--- Content provided by FirstRanker.com ---
a) Decimal manipulations
b) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
INDEXSl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
--- Content provided by FirstRanker.com ---
4 ADT Stack 195 String Operations 21
6 Abstract Class 23
7 Exception Handling 25
8 File Information 27
--- Content provided by FirstRanker.com ---
9 Multithreading 2910 Generic Function 31
11 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
--- Content provided by FirstRanker.com ---
Ex. No.:1
ELECTRICITY BILL GENERATION
Aim:
To develop a Java application to generate Electricity bill.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
--- Content provided by FirstRanker.com ---
previous month reading, current month reading, type of EB connection (i.e domestic orcommercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 4 per unit? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 6 per unit? > 501 units - Rs. 7 per unit
5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Electricity Bill Java application was successfully executed.Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Payroll Processing(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
Ex. No.:2
--- Content provided by FirstRanker.com ---
Currency Converter, Distance Converter and Time Converter
Aim:
To develop a Java application to implement currency converter , distance converter and time converter
using packages.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
--- Content provided by FirstRanker.com ---
3. Create corresponding code for conversion4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
17Ex. No.:3
PAYROLL PROCESSING
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application with employee class and generate pay slips for the employees with theirgross and net salary.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
members.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
--- Content provided by FirstRanker.com ---
from employee class.4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
18
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created with with employee class and pay slips are generated for
the employees with their gross and net salary.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained by applying the concept of inheritance togenerate Payroll Processing application using Java.
Applications:
(1) EB Bill Generation
(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
--- Content provided by FirstRanker.com ---
Ex. No.:4
ADT STACK
Aim
To design a Java interface for ADT Stack using array.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the interface.3. Read the elements using array.
4. Initialize stackTop pointer as zero,
5. Define and use the method Push() to insert the elements into the stack with ?STACK
OVERFLOW? condition.
--- Content provided by FirstRanker.com ---
6. Define and use the method pop() to remove an element from an array with ?STACKUNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the design and implementation of ADT Stack using array has successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of array to generate
--- Content provided by FirstRanker.com ---
ADT Stack using Java.Applications:
(1) ADT Queue
(2) ADT circular queue
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
21Ex. No.:5
STRING OPERATIONS
Aim
--- Content provided by FirstRanker.com ---
To write a program to perform string operations using ArrayList.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Add the String as an object to List.
3. Get the choice from the user and do according to the choice
a. Append-add at end
--- Content provided by FirstRanker.com ---
b. Insert-add at particular indexc. Search
d. List all string starts with given letter.
3. Display the result
4. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
III SEMESTER - R 2017--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of theIndustry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
--- Content provided by FirstRanker.com ---
on heart and soul--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
--- Content provided by FirstRanker.com ---
1. FUNDAMENTALSTo impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
--- Content provided by FirstRanker.com ---
complex software problems in industry and to develop practical solutions for them3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
--- Content provided by FirstRanker.com ---
4. PROFESSIONAL SKILLSTo bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
--- Content provided by FirstRanker.com ---
To develop the ability of students to establish themselves as professionals in Computer Scienceand Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
PROGRAMME OUTCOMES (POs)
--- Content provided by FirstRanker.com ---
On completion of the B.E. (CSE) degree, the graduates will be ablea) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
--- Content provided by FirstRanker.com ---
c) To design and develop innovative and creative software applicationsd) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
--- Content provided by FirstRanker.com ---
environmental, social, political, ethical, safe and sustainableh) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
--- Content provided by FirstRanker.com ---
j) To engage in lifelong learning and exhibit their technical skillsk) To develop and manage projects in multidisciplinary environment
9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
--- Content provided by FirstRanker.com ---
following tariff.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 6 per unitIf the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 7 per unit2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_noas members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
4. Design a Java interface for ADT Stack. Implement this interface using array. Providenecessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
--- Content provided by FirstRanker.com ---
b. Insert ? add at particular indexc. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
--- Content provided by FirstRanker.com ---
Rectangle, Triangle and Circle such that each one of the classes extends the classShape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
--- Content provided by FirstRanker.com ---
whether the file exists, whether the file is readable, or writable, the type of file and thelength of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
--- Content provided by FirstRanker.com ---
will print the value of cube of the number.10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
--- Content provided by FirstRanker.com ---
b) Scientific manipulations12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
--- Content provided by FirstRanker.com ---
1 Electricity Bill Generation 132 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
--- Content provided by FirstRanker.com ---
6 Abstract Class 237 Exception Handling 25
8 File Information 27
9 Multithreading 29
10 Generic Function 31
--- Content provided by FirstRanker.com ---
11 Calculator 3312 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
--- Content provided by FirstRanker.com ---
ELECTRICITY BILL GENERATIONAim:
To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
--- Content provided by FirstRanker.com ---
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
--- Content provided by FirstRanker.com ---
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application usingJava.
Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
15Ex. No.:2
Currency Converter, Distance Converter and Time Converter
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application to implement currency converter , distance converter and time converter
using packages.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
4. Print the converted value.
--- Content provided by FirstRanker.com ---
5. Stop the program--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
--- Content provided by FirstRanker.com ---
Applications :(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
--- Content provided by FirstRanker.com ---
Ex. No.:3PAYROLL PROCESSING
Aim:
To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no asmembers.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
--- Content provided by FirstRanker.com ---
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
18
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created with with employee class and pay slips are generated forthe employees with their gross and net salary.
Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) EB Bill Generation
(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
Ex. No.:4
--- Content provided by FirstRanker.com ---
ADT STACKAim
To design a Java interface for ADT Stack using array.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the interface.
3. Read the elements using array.
--- Content provided by FirstRanker.com ---
4. Initialize stackTop pointer as zero,5. Define and use the method Push() to insert the elements into the stack with ?STACK
OVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
--- Content provided by FirstRanker.com ---
7. Display the output.--- Content provided by FirstRanker.com ---
20
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the design and implementation of ADT Stack using array has successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) ADT Queue
(2) ADT circular queue
--- Content provided by FirstRanker.com ---
21
--- Content provided by FirstRanker.com ---
Ex. No.:5STRING OPERATIONS
Aim
To write a program to perform string operations using ArrayList.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Add the String as an object to List.3. Get the choice from the user and do according to the choice
a. Append-add at end
b. Insert-add at particular index
c. Search
--- Content provided by FirstRanker.com ---
d. List all string starts with given letter.3. Display the result
4. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
22Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the implementation of string operations using array list has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) Reverse of the String.
(2) String Matching.
(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
Name : ______________________________________Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious andenterprising professionals conforming to global standards through value based quality education and
training.
? To provide competent technical manpower capable of meeting requirements of the
--- Content provided by FirstRanker.com ---
Industry? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineeringthrough quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
--- Content provided by FirstRanker.com ---
To impart students with fundamental knowledge in Mathematics, Science and fundamentals ofengineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
--- Content provided by FirstRanker.com ---
3. BREADTHTo provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
--- Content provided by FirstRanker.com ---
To bestow students with adequate training and provide opportunities to work as team that will buildup their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
--- Content provided by FirstRanker.com ---
and Engineering and to create awareness about the need for lifelong learning and pursuing advanceddegrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
--- Content provided by FirstRanker.com ---
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals inComputer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
--- Content provided by FirstRanker.com ---
d) To understand a complex real world problem and develop an efficient practical solutione) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
--- Content provided by FirstRanker.com ---
h) To communicate effectively and make others understand exactly what they are trying to convey inboth verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
--- Content provided by FirstRanker.com ---
k) To develop and manage projects in multidisciplinary environment9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORYSYLLABUS
? To build software development skills using java programming for real-world applications.
--- Content provided by FirstRanker.com ---
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
? To develop applications using generic programming and event handling.
--- Content provided by FirstRanker.com ---
LIST OF EXPERIMENTS:1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
following tariff.
--- Content provided by FirstRanker.com ---
If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INRand vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
10
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
--- Content provided by FirstRanker.com ---
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professorfrom employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
--- Content provided by FirstRanker.com ---
necessary exception handling in both the implementations.5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
b. Insert ? add at particular index
--- Content provided by FirstRanker.com ---
c. Searchd. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
--- Content provided by FirstRanker.com ---
Shape. Each one of the classes contains only the method print Area () that prints thearea of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
--- Content provided by FirstRanker.com ---
length of the file in bytes.9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
--- Content provided by FirstRanker.com ---
10. Write a java program to find the maximum value from the given type of elements using ageneric function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
b) Scientific manipulations
--- Content provided by FirstRanker.com ---
12. Develop a mini project for any application using Java concepts.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
--- Content provided by FirstRanker.com ---
2 Currency converter , Distance converter and Time converter 153 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
6 Abstract Class 23
--- Content provided by FirstRanker.com ---
7 Exception Handling 258 File Information 27
9 Multithreading 29
10 Generic Function 31
11 Calculator 33
--- Content provided by FirstRanker.com ---
12 Mini Project ? Vehicle Management System 36--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
ELECTRICITY BILL GENERATION
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs.1 per unit? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 2 per unit? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount6. Stop the program
14
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
--- Content provided by FirstRanker.com ---
Java.Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
--- Content provided by FirstRanker.com ---
Ex. No.:2
Currency Converter, Distance Converter and Time Converter
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application to implement currency converter , distance converter and time converterusing packages.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created for currency conversion, distance conversion and timeconversion and it was successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Kilogram to gram conversion(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
Ex. No.:3
--- Content provided by FirstRanker.com ---
PAYROLL PROCESSINGAim:
To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
--- Content provided by FirstRanker.com ---
members.3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
--- Content provided by FirstRanker.com ---
5. Generate pay slips for the employees with their gross and net salary.6. Stop the program
--- Content provided by FirstRanker.com ---
18
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Java application has been created with with employee class and pay slips are generated for
--- Content provided by FirstRanker.com ---
the employees with their gross and net salary.Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) EB Bill Generation(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
Ex. No.:4
ADT STACK
--- Content provided by FirstRanker.com ---
AimTo design a Java interface for ADT Stack using array.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Define the interface.
3. Read the elements using array.
4. Initialize stackTop pointer as zero,
--- Content provided by FirstRanker.com ---
5. Define and use the method Push() to insert the elements into the stack with ?STACKOVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the design and implementation of ADT Stack using array has successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) ADT Queue(2) ADT circular queue
--- Content provided by FirstRanker.com ---
21
Ex. No.:5
--- Content provided by FirstRanker.com ---
STRING OPERATIONSAim
To write a program to perform string operations using ArrayList.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Add the String as an object to List.
--- Content provided by FirstRanker.com ---
3. Get the choice from the user and do according to the choicea. Append-add at end
b. Insert-add at particular index
c. Search
d. List all string starts with given letter.
--- Content provided by FirstRanker.com ---
3. Display the result4. Stop the program.
--- Content provided by FirstRanker.com ---
22
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the implementation of string operations using array list has been successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) Reverse of the String.(2) String Matching.
(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
23Ex. No.:6
ABSTRACT CLASS
Aim
--- Content provided by FirstRanker.com ---
To write a Java Program to create an abstract class named Shape and provide three classes namedRectangle, Triangle and Circle such that each one of the classes extends the class Shape.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the abstract class shape.
--- Content provided by FirstRanker.com ---
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
--- Content provided by FirstRanker.com ---
Reg. No. : ______________________________________Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5is committed to provide highly disciplined, conscientious and
--- Content provided by FirstRanker.com ---
enterprising professionals conforming to global standards through value based quality education andtraining.
? To provide competent technical manpower capable of meeting requirements of the
Industry
--- Content provided by FirstRanker.com ---
? To contribute to the promotion of Academic Excellence in pursuit of TechnicalEducation at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
--- Content provided by FirstRanker.com ---
through quality education and to provide enthusiastic professionals with commitment? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
--- Content provided by FirstRanker.com ---
engineering that will mould them to be successful professionals2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
--- Content provided by FirstRanker.com ---
To provide relevant training and experience to bridge the gap between theory and practice whichenables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
--- Content provided by FirstRanker.com ---
up their communication skills, individual leadership and supportive qualities, and to enable them to adaptand work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
--- Content provided by FirstRanker.com ---
degrees--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
--- Content provided by FirstRanker.com ---
Computer Science and Engineering fieldb) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
--- Content provided by FirstRanker.com ---
e) To create, select and apply appropriate techniques, resources, modern engineering and IT toolsf) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
--- Content provided by FirstRanker.com ---
both verbal and written formsi) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9
CS8383 ?OBJECT ORIENTED LABORATORY
--- Content provided by FirstRanker.com ---
SYLLABUS? To build software development skills using java programming for real-world applications.
--- Content provided by FirstRanker.com ---
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handlingand file processing.
? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
--- Content provided by FirstRanker.com ---
1. Develop a Java application to generate Electricity bill. Create a class with the following members:Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 1 per unit? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 2 per unit? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
--- Content provided by FirstRanker.com ---
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter(hours to minutes, seconds and vice versa) using packages.
COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
10
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
--- Content provided by FirstRanker.com ---
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP asDA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
--- Content provided by FirstRanker.com ---
5. Write a program to perform string operations using ArrayList. Write functionsfor the following
a. Append - add at end
b. Insert ? add at particular index
c. Search
--- Content provided by FirstRanker.com ---
d. List all string starts with given letter6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
--- Content provided by FirstRanker.com ---
area of the given shape.7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
--- Content provided by FirstRanker.com ---
9. Write a java program that implements a multi-threaded application that has three threads.First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
--- Content provided by FirstRanker.com ---
generic function.11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11a) Decimal manipulations
b) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORYINDEX
Sl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
--- Content provided by FirstRanker.com ---
3 Payroll Processing 184 ADT Stack 19
5 String Operations 21
6 Abstract Class 23
7 Exception Handling 25
--- Content provided by FirstRanker.com ---
8 File Information 279 Multithreading 29
10 Generic Function 31
11 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13Ex. No.:1
ELECTRICITY BILL GENERATION
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application to generate Electricity bill.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create consumer class with the following members: Consumer no., consumer name,previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs.2.50 per unit? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 4.50 per unit? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
5. Print the amount
--- Content provided by FirstRanker.com ---
6. Stop the program14
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
--- Content provided by FirstRanker.com ---
Applications :(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
--- Content provided by FirstRanker.com ---
Ex. No.:2Currency Converter, Distance Converter and Time Converter
Aim:
To develop a Java application to implement currency converter , distance converter and time converter
--- Content provided by FirstRanker.com ---
using packages.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create three packages for currency converter , distance converter and time converter.3. Create corresponding code for conversion
4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Java application has been created for currency conversion, distance conversion and time
--- Content provided by FirstRanker.com ---
conversion and it was successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
(1) Kilogram to gram conversion
--- Content provided by FirstRanker.com ---
(2) Celsius to Fahrenheit conversion--- Content provided by FirstRanker.com ---
17
Ex. No.:3
PAYROLL PROCESSING
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
members.
--- Content provided by FirstRanker.com ---
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professorfrom employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
5. Generate pay slips for the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
6. Stop the program--- Content provided by FirstRanker.com ---
18
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created with with employee class and pay slips are generated for
the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
Applications:
(1) EB Bill Generation
--- Content provided by FirstRanker.com ---
(2) Income Tax Calculation--- Content provided by FirstRanker.com ---
19Ex. No.:4
ADT STACK
Aim
--- Content provided by FirstRanker.com ---
To design a Java interface for ADT Stack using array.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Define the interface.
3. Read the elements using array.
4. Initialize stackTop pointer as zero,
5. Define and use the method Push() to insert the elements into the stack with ?STACK
--- Content provided by FirstRanker.com ---
OVERFLOW? condition.6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the design and implementation of ADT Stack using array has successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of array to generateADT Stack using Java.
Applications:
(1) ADT Queue
--- Content provided by FirstRanker.com ---
(2) ADT circular queue--- Content provided by FirstRanker.com ---
21
Ex. No.:5
STRING OPERATIONS
--- Content provided by FirstRanker.com ---
AimTo write a program to perform string operations using ArrayList.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Add the String as an object to List.
3. Get the choice from the user and do according to the choice
--- Content provided by FirstRanker.com ---
a. Append-add at endb. Insert-add at particular index
c. Search
d. List all string starts with given letter.
3. Display the result
--- Content provided by FirstRanker.com ---
4. Stop the program.--- Content provided by FirstRanker.com ---
22
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the implementation of string operations using array list has been successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
Applications:
(1) Reverse of the String.
--- Content provided by FirstRanker.com ---
(2) String Matching.(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
23
--- Content provided by FirstRanker.com ---
Ex. No.:6
ABSTRACT CLASS
Aim
To write a Java Program to create an abstract class named Shape and provide three classes named
--- Content provided by FirstRanker.com ---
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Define the abstract class shape.
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
--- Content provided by FirstRanker.com ---
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
--- Content provided by FirstRanker.com ---
Sample output:
Result:
Thus the design and implementation of Abstract class has been successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
Java.
Applications:
(1) Volume of the Cube
--- Content provided by FirstRanker.com ---
(2) Length of the Cube(3) Area of Triangle
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
--- Content provided by FirstRanker.com ---
Reg. No. : ______________________________________Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5is committed to provide highly disciplined, conscientious and
--- Content provided by FirstRanker.com ---
enterprising professionals conforming to global standards through value based quality education andtraining.
? To provide competent technical manpower capable of meeting requirements of the
Industry
--- Content provided by FirstRanker.com ---
? To contribute to the promotion of Academic Excellence in pursuit of TechnicalEducation at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
--- Content provided by FirstRanker.com ---
through quality education and to provide enthusiastic professionals with commitment? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
--- Content provided by FirstRanker.com ---
engineering that will mould them to be successful professionals2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
--- Content provided by FirstRanker.com ---
To provide relevant training and experience to bridge the gap between theory and practice whichenables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
--- Content provided by FirstRanker.com ---
up their communication skills, individual leadership and supportive qualities, and to enable them to adaptand work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
--- Content provided by FirstRanker.com ---
degrees--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
--- Content provided by FirstRanker.com ---
Computer Science and Engineering fieldb) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
--- Content provided by FirstRanker.com ---
e) To create, select and apply appropriate techniques, resources, modern engineering and IT toolsf) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
--- Content provided by FirstRanker.com ---
both verbal and written formsi) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9
CS8383 ?OBJECT ORIENTED LABORATORY
--- Content provided by FirstRanker.com ---
SYLLABUS? To build software development skills using java programming for real-world applications.
--- Content provided by FirstRanker.com ---
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handlingand file processing.
? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
--- Content provided by FirstRanker.com ---
1. Develop a Java application to generate Electricity bill. Create a class with the following members:Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 1 per unit? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 2 per unit? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
--- Content provided by FirstRanker.com ---
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter(hours to minutes, seconds and vice versa) using packages.
COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
10
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
--- Content provided by FirstRanker.com ---
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP asDA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
--- Content provided by FirstRanker.com ---
5. Write a program to perform string operations using ArrayList. Write functionsfor the following
a. Append - add at end
b. Insert ? add at particular index
c. Search
--- Content provided by FirstRanker.com ---
d. List all string starts with given letter6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
--- Content provided by FirstRanker.com ---
area of the given shape.7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
--- Content provided by FirstRanker.com ---
9. Write a java program that implements a multi-threaded application that has three threads.First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
--- Content provided by FirstRanker.com ---
generic function.11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11a) Decimal manipulations
b) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORYINDEX
Sl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
--- Content provided by FirstRanker.com ---
3 Payroll Processing 184 ADT Stack 19
5 String Operations 21
6 Abstract Class 23
7 Exception Handling 25
--- Content provided by FirstRanker.com ---
8 File Information 279 Multithreading 29
10 Generic Function 31
11 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13Ex. No.:1
ELECTRICITY BILL GENERATION
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application to generate Electricity bill.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create consumer class with the following members: Consumer no., consumer name,previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs.2.50 per unit? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 4.50 per unit? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
5. Print the amount
--- Content provided by FirstRanker.com ---
6. Stop the program14
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
--- Content provided by FirstRanker.com ---
Applications :(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
--- Content provided by FirstRanker.com ---
Ex. No.:2Currency Converter, Distance Converter and Time Converter
Aim:
To develop a Java application to implement currency converter , distance converter and time converter
--- Content provided by FirstRanker.com ---
using packages.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create three packages for currency converter , distance converter and time converter.3. Create corresponding code for conversion
4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Java application has been created for currency conversion, distance conversion and time
--- Content provided by FirstRanker.com ---
conversion and it was successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
(1) Kilogram to gram conversion
--- Content provided by FirstRanker.com ---
(2) Celsius to Fahrenheit conversion--- Content provided by FirstRanker.com ---
17
Ex. No.:3
PAYROLL PROCESSING
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
members.
--- Content provided by FirstRanker.com ---
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professorfrom employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
5. Generate pay slips for the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
6. Stop the program--- Content provided by FirstRanker.com ---
18
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created with with employee class and pay slips are generated for
the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
Applications:
(1) EB Bill Generation
--- Content provided by FirstRanker.com ---
(2) Income Tax Calculation--- Content provided by FirstRanker.com ---
19Ex. No.:4
ADT STACK
Aim
--- Content provided by FirstRanker.com ---
To design a Java interface for ADT Stack using array.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Define the interface.
3. Read the elements using array.
4. Initialize stackTop pointer as zero,
5. Define and use the method Push() to insert the elements into the stack with ?STACK
--- Content provided by FirstRanker.com ---
OVERFLOW? condition.6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the design and implementation of ADT Stack using array has successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of array to generateADT Stack using Java.
Applications:
(1) ADT Queue
--- Content provided by FirstRanker.com ---
(2) ADT circular queue--- Content provided by FirstRanker.com ---
21
Ex. No.:5
STRING OPERATIONS
--- Content provided by FirstRanker.com ---
AimTo write a program to perform string operations using ArrayList.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Add the String as an object to List.
3. Get the choice from the user and do according to the choice
--- Content provided by FirstRanker.com ---
a. Append-add at endb. Insert-add at particular index
c. Search
d. List all string starts with given letter.
3. Display the result
--- Content provided by FirstRanker.com ---
4. Stop the program.--- Content provided by FirstRanker.com ---
22
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the implementation of string operations using array list has been successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
Applications:
(1) Reverse of the String.
--- Content provided by FirstRanker.com ---
(2) String Matching.(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
23
--- Content provided by FirstRanker.com ---
Ex. No.:6
ABSTRACT CLASS
Aim
To write a Java Program to create an abstract class named Shape and provide three classes named
--- Content provided by FirstRanker.com ---
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Define the abstract class shape.
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
--- Content provided by FirstRanker.com ---
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
--- Content provided by FirstRanker.com ---
Sample output:
Result:
Thus the design and implementation of Abstract class has been successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
Java.
Applications:
(1) Volume of the Cube
--- Content provided by FirstRanker.com ---
(2) Length of the Cube(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25Ex. No.:7
EXCEPTION HANDLING
Aim
--- Content provided by FirstRanker.com ---
To write a Java program to implement user defined exception handling.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Define the exception for getting a number from the user.
3. If the number is positive print the number as such.
--- Content provided by FirstRanker.com ---
4. If the number is negative throw the exception to the user as ?Number must bepositive?.
5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
III SEMESTER - R 2017--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of theIndustry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
--- Content provided by FirstRanker.com ---
on heart and soul--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
--- Content provided by FirstRanker.com ---
1. FUNDAMENTALSTo impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
--- Content provided by FirstRanker.com ---
complex software problems in industry and to develop practical solutions for them3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
--- Content provided by FirstRanker.com ---
4. PROFESSIONAL SKILLSTo bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
--- Content provided by FirstRanker.com ---
To develop the ability of students to establish themselves as professionals in Computer Scienceand Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
PROGRAMME OUTCOMES (POs)
--- Content provided by FirstRanker.com ---
On completion of the B.E. (CSE) degree, the graduates will be ablea) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
--- Content provided by FirstRanker.com ---
c) To design and develop innovative and creative software applicationsd) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
--- Content provided by FirstRanker.com ---
environmental, social, political, ethical, safe and sustainableh) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
--- Content provided by FirstRanker.com ---
j) To engage in lifelong learning and exhibit their technical skillsk) To develop and manage projects in multidisciplinary environment
9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
--- Content provided by FirstRanker.com ---
following tariff.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 6 per unitIf the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 7 per unit2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_noas members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
4. Design a Java interface for ADT Stack. Implement this interface using array. Providenecessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
--- Content provided by FirstRanker.com ---
b. Insert ? add at particular indexc. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
--- Content provided by FirstRanker.com ---
Rectangle, Triangle and Circle such that each one of the classes extends the classShape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
--- Content provided by FirstRanker.com ---
whether the file exists, whether the file is readable, or writable, the type of file and thelength of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
--- Content provided by FirstRanker.com ---
will print the value of cube of the number.10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
--- Content provided by FirstRanker.com ---
b) Scientific manipulations12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
--- Content provided by FirstRanker.com ---
1 Electricity Bill Generation 132 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
--- Content provided by FirstRanker.com ---
6 Abstract Class 237 Exception Handling 25
8 File Information 27
9 Multithreading 29
10 Generic Function 31
--- Content provided by FirstRanker.com ---
11 Calculator 3312 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
--- Content provided by FirstRanker.com ---
ELECTRICITY BILL GENERATIONAim:
To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
--- Content provided by FirstRanker.com ---
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
--- Content provided by FirstRanker.com ---
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application usingJava.
Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
15Ex. No.:2
Currency Converter, Distance Converter and Time Converter
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application to implement currency converter , distance converter and time converter
using packages.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
4. Print the converted value.
--- Content provided by FirstRanker.com ---
5. Stop the program--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
--- Content provided by FirstRanker.com ---
Applications :(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
--- Content provided by FirstRanker.com ---
Ex. No.:3PAYROLL PROCESSING
Aim:
To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no asmembers.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
--- Content provided by FirstRanker.com ---
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
18
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created with with employee class and pay slips are generated forthe employees with their gross and net salary.
Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) EB Bill Generation
(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
Ex. No.:4
--- Content provided by FirstRanker.com ---
ADT STACKAim
To design a Java interface for ADT Stack using array.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the interface.
3. Read the elements using array.
--- Content provided by FirstRanker.com ---
4. Initialize stackTop pointer as zero,5. Define and use the method Push() to insert the elements into the stack with ?STACK
OVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
--- Content provided by FirstRanker.com ---
7. Display the output.--- Content provided by FirstRanker.com ---
20
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the design and implementation of ADT Stack using array has successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) ADT Queue
(2) ADT circular queue
--- Content provided by FirstRanker.com ---
21
--- Content provided by FirstRanker.com ---
Ex. No.:5STRING OPERATIONS
Aim
To write a program to perform string operations using ArrayList.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Add the String as an object to List.3. Get the choice from the user and do according to the choice
a. Append-add at end
b. Insert-add at particular index
c. Search
--- Content provided by FirstRanker.com ---
d. List all string starts with given letter.3. Display the result
4. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
22Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the implementation of string operations using array list has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) Reverse of the String.
(2) String Matching.
(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
23
Ex. No.:6
ABSTRACT CLASS
--- Content provided by FirstRanker.com ---
AimTo write a Java Program to create an abstract class named Shape and provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the abstract class shape.3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
--- Content provided by FirstRanker.com ---
7.Stop the Program.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the design and implementation of Abstract class has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
Java.
--- Content provided by FirstRanker.com ---
Applications:(1) Volume of the Cube
(2) Length of the Cube
(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25
Ex. No.:7
--- Content provided by FirstRanker.com ---
EXCEPTION HANDLINGAim
To write a Java program to implement user defined exception handling.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the exception for getting a number from the user.3. If the number is positive print the number as such.
4. If the number is negative throw the exception to the user as ?Number must be
positive?.
5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26
--- Content provided by FirstRanker.com ---
Sample output:
Result:
Thus the user defined exception has been successfully implemented.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of Exception handling
for an user defined exception using Java.
Applications:
(1) Throwing exception for Checking the @ symbol in Email Id
--- Content provided by FirstRanker.com ---
(2) Throwing exception for password mismatch.--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORYIII SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
--- Content provided by FirstRanker.com ---
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tagon heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGTo strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
.? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
--- Content provided by FirstRanker.com ---
To provide students with sound knowledge in engineering and experimental skills to identifycomplex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
--- Content provided by FirstRanker.com ---
requiring interdisciplinary skills4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
--- Content provided by FirstRanker.com ---
5. LIFELONG LEARNINGTo develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
--- Content provided by FirstRanker.com ---
careerc) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
--- Content provided by FirstRanker.com ---
g) To develop a system that will meet expected needs within realistic constraints such as economical,environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
--- Content provided by FirstRanker.com ---
coordinationj) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
--- Content provided by FirstRanker.com ---
(i.e domestic or commercial). Compute the bill amount using thefollowing tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 4 per unit? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 6 per unit? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES
10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
--- Content provided by FirstRanker.com ---
for staff club fund. Generate pay slips for the employees with their gross and net salary.4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
--- Content provided by FirstRanker.com ---
a. Append - add at endb. Insert ? add at particular index
c. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
--- Content provided by FirstRanker.com ---
integers and an empty method named print Area(). Provide three classes namedRectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
--- Content provided by FirstRanker.com ---
8. Write a Java program that reads a file name from the user, displays information aboutwhether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
--- Content provided by FirstRanker.com ---
thread computes the square of the number and prints. If the value is odd, the third threadwill print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
--- Content provided by FirstRanker.com ---
following options.11
--- Content provided by FirstRanker.com ---
a) Decimal manipulationsb) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
--- Content provided by FirstRanker.com ---
Sl. No. Name of the Experiment Page No.1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
4 ADT Stack 19
--- Content provided by FirstRanker.com ---
5 String Operations 216 Abstract Class 23
7 Exception Handling 25
8 File Information 27
9 Multithreading 29
--- Content provided by FirstRanker.com ---
10 Generic Function 3111 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
--- Content provided by FirstRanker.com ---
Ex. No.:1ELECTRICITY BILL GENERATION
Aim:
To develop a Java application to generate Electricity bill.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
--- Content provided by FirstRanker.com ---
commercial).3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs.6 per unit4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 7 per unit5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Electricity Bill Java application was successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
Applications :
(1) Payroll Processing
--- Content provided by FirstRanker.com ---
(2) PF Calculation--- Content provided by FirstRanker.com ---
15
Ex. No.:2
--- Content provided by FirstRanker.com ---
Currency Converter, Distance Converter and Time ConverterAim:
To develop a Java application to implement currency converter , distance converter and time converter
using packages.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
--- Content provided by FirstRanker.com ---
4. Print the converted value.5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.Applications :
(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
--- Content provided by FirstRanker.com ---
Ex. No.:3
PAYROLL PROCESSING
Aim:
To develop a Java application with employee class and generate pay slips for the employees with their
--- Content provided by FirstRanker.com ---
gross and net salary.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
members.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
--- Content provided by FirstRanker.com ---
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
18Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Java application has been created with with employee class and pay slips are generated for
the employees with their gross and net salary.
Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
--- Content provided by FirstRanker.com ---
generate Payroll Processing application using Java.Applications:
(1) EB Bill Generation
(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
--- Content provided by FirstRanker.com ---
Ex. No.:4ADT STACK
Aim
To design a Java interface for ADT Stack using array.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Define the interface.
--- Content provided by FirstRanker.com ---
3. Read the elements using array.4. Initialize stackTop pointer as zero,
5. Define and use the method Push() to insert the elements into the stack with ?STACK
OVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
--- Content provided by FirstRanker.com ---
UNDERFLOW? condition7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the design and implementation of ADT Stack using array has successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
--- Content provided by FirstRanker.com ---
Applications:
(1) ADT Queue
(2) ADT circular queue
--- Content provided by FirstRanker.com ---
21
--- Content provided by FirstRanker.com ---
Ex. No.:5
STRING OPERATIONS
Aim
To write a program to perform string operations using ArrayList.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Add the String as an object to List.
3. Get the choice from the user and do according to the choice
a. Append-add at end
b. Insert-add at particular index
--- Content provided by FirstRanker.com ---
c. Searchd. List all string starts with given letter.
3. Display the result
4. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
22
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of string operations using array list has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
--- Content provided by FirstRanker.com ---
manipulations using Java.Applications:
(1) Reverse of the String.
(2) String Matching.
(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
23
Ex. No.:6
--- Content provided by FirstRanker.com ---
ABSTRACT CLASSAim
To write a Java Program to create an abstract class named Shape and provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Define the abstract class shape.
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
--- Content provided by FirstRanker.com ---
6. Print the area of the Rectangle,Triangle and Circle .7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the design and implementation of Abstract class has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
--- Content provided by FirstRanker.com ---
Java.Applications:
(1) Volume of the Cube
(2) Length of the Cube
(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25
--- Content provided by FirstRanker.com ---
Ex. No.:7EXCEPTION HANDLING
Aim
To write a Java program to implement user defined exception handling.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Define the exception for getting a number from the user.
3. If the number is positive print the number as such.
4. If the number is negative throw the exception to the user as ?Number must be
positive?.
--- Content provided by FirstRanker.com ---
5. Stop the Program.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the user defined exception has been successfully implemented.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of Exception handling
for an user defined exception using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) Throwing exception for Checking the @ symbol in Email Id(2) Throwing exception for password mismatch.
--- Content provided by FirstRanker.com ---
27
--- Content provided by FirstRanker.com ---
Ex. No.: 8
FILE INFORMATION
Aim
--- Content provided by FirstRanker.com ---
To write a Java program that reads a file name from the user, displays information about whether the fileexists, whether the file is readable, or writable, the type of file and the length of the file in bytes.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Read the filename from the user.
3. Use getName() Method to display the filename.
4. Use getPath() Method to display the path of the file.
--- Content provided by FirstRanker.com ---
5. Use getParent() Method to display its parent?s information.6. Use exists() Method to display whether the file exist or not
7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.
8.Use canRead() and canWrite) methods to display whether the file is readable or writable.
9. Use lastModified() Method to display the modified information.
--- Content provided by FirstRanker.com ---
10. Use length() method to display the size of the file.11. Use isHiddden() Method to display whether the file is hidden or not.
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
--- Content provided by FirstRanker.com ---
Reg. No. : ______________________________________Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5is committed to provide highly disciplined, conscientious and
--- Content provided by FirstRanker.com ---
enterprising professionals conforming to global standards through value based quality education andtraining.
? To provide competent technical manpower capable of meeting requirements of the
Industry
--- Content provided by FirstRanker.com ---
? To contribute to the promotion of Academic Excellence in pursuit of TechnicalEducation at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
--- Content provided by FirstRanker.com ---
through quality education and to provide enthusiastic professionals with commitment? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
--- Content provided by FirstRanker.com ---
engineering that will mould them to be successful professionals2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
--- Content provided by FirstRanker.com ---
To provide relevant training and experience to bridge the gap between theory and practice whichenables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
--- Content provided by FirstRanker.com ---
up their communication skills, individual leadership and supportive qualities, and to enable them to adaptand work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
--- Content provided by FirstRanker.com ---
degrees--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
--- Content provided by FirstRanker.com ---
Computer Science and Engineering fieldb) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
--- Content provided by FirstRanker.com ---
e) To create, select and apply appropriate techniques, resources, modern engineering and IT toolsf) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
--- Content provided by FirstRanker.com ---
both verbal and written formsi) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9
CS8383 ?OBJECT ORIENTED LABORATORY
--- Content provided by FirstRanker.com ---
SYLLABUS? To build software development skills using java programming for real-world applications.
--- Content provided by FirstRanker.com ---
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handlingand file processing.
? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
--- Content provided by FirstRanker.com ---
1. Develop a Java application to generate Electricity bill. Create a class with the following members:Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 1 per unit? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 2 per unit? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
--- Content provided by FirstRanker.com ---
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter(hours to minutes, seconds and vice versa) using packages.
COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
10
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
--- Content provided by FirstRanker.com ---
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP asDA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
--- Content provided by FirstRanker.com ---
5. Write a program to perform string operations using ArrayList. Write functionsfor the following
a. Append - add at end
b. Insert ? add at particular index
c. Search
--- Content provided by FirstRanker.com ---
d. List all string starts with given letter6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
--- Content provided by FirstRanker.com ---
area of the given shape.7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
--- Content provided by FirstRanker.com ---
9. Write a java program that implements a multi-threaded application that has three threads.First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
--- Content provided by FirstRanker.com ---
generic function.11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11a) Decimal manipulations
b) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORYINDEX
Sl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
--- Content provided by FirstRanker.com ---
3 Payroll Processing 184 ADT Stack 19
5 String Operations 21
6 Abstract Class 23
7 Exception Handling 25
--- Content provided by FirstRanker.com ---
8 File Information 279 Multithreading 29
10 Generic Function 31
11 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13Ex. No.:1
ELECTRICITY BILL GENERATION
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application to generate Electricity bill.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create consumer class with the following members: Consumer no., consumer name,previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs.2.50 per unit? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 4.50 per unit? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
5. Print the amount
--- Content provided by FirstRanker.com ---
6. Stop the program14
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
--- Content provided by FirstRanker.com ---
Applications :(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
--- Content provided by FirstRanker.com ---
Ex. No.:2Currency Converter, Distance Converter and Time Converter
Aim:
To develop a Java application to implement currency converter , distance converter and time converter
--- Content provided by FirstRanker.com ---
using packages.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create three packages for currency converter , distance converter and time converter.3. Create corresponding code for conversion
4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Java application has been created for currency conversion, distance conversion and time
--- Content provided by FirstRanker.com ---
conversion and it was successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
(1) Kilogram to gram conversion
--- Content provided by FirstRanker.com ---
(2) Celsius to Fahrenheit conversion--- Content provided by FirstRanker.com ---
17
Ex. No.:3
PAYROLL PROCESSING
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
members.
--- Content provided by FirstRanker.com ---
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professorfrom employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
5. Generate pay slips for the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
6. Stop the program--- Content provided by FirstRanker.com ---
18
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created with with employee class and pay slips are generated for
the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
Applications:
(1) EB Bill Generation
--- Content provided by FirstRanker.com ---
(2) Income Tax Calculation--- Content provided by FirstRanker.com ---
19Ex. No.:4
ADT STACK
Aim
--- Content provided by FirstRanker.com ---
To design a Java interface for ADT Stack using array.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Define the interface.
3. Read the elements using array.
4. Initialize stackTop pointer as zero,
5. Define and use the method Push() to insert the elements into the stack with ?STACK
--- Content provided by FirstRanker.com ---
OVERFLOW? condition.6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the design and implementation of ADT Stack using array has successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of array to generateADT Stack using Java.
Applications:
(1) ADT Queue
--- Content provided by FirstRanker.com ---
(2) ADT circular queue--- Content provided by FirstRanker.com ---
21
Ex. No.:5
STRING OPERATIONS
--- Content provided by FirstRanker.com ---
AimTo write a program to perform string operations using ArrayList.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Add the String as an object to List.
3. Get the choice from the user and do according to the choice
--- Content provided by FirstRanker.com ---
a. Append-add at endb. Insert-add at particular index
c. Search
d. List all string starts with given letter.
3. Display the result
--- Content provided by FirstRanker.com ---
4. Stop the program.--- Content provided by FirstRanker.com ---
22
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the implementation of string operations using array list has been successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
Applications:
(1) Reverse of the String.
--- Content provided by FirstRanker.com ---
(2) String Matching.(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
23
--- Content provided by FirstRanker.com ---
Ex. No.:6
ABSTRACT CLASS
Aim
To write a Java Program to create an abstract class named Shape and provide three classes named
--- Content provided by FirstRanker.com ---
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Define the abstract class shape.
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
--- Content provided by FirstRanker.com ---
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
--- Content provided by FirstRanker.com ---
Sample output:
Result:
Thus the design and implementation of Abstract class has been successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
Java.
Applications:
(1) Volume of the Cube
--- Content provided by FirstRanker.com ---
(2) Length of the Cube(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25Ex. No.:7
EXCEPTION HANDLING
Aim
--- Content provided by FirstRanker.com ---
To write a Java program to implement user defined exception handling.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Define the exception for getting a number from the user.
3. If the number is positive print the number as such.
--- Content provided by FirstRanker.com ---
4. If the number is negative throw the exception to the user as ?Number must bepositive?.
5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the user defined exception has been successfully implemented.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of Exception handling
--- Content provided by FirstRanker.com ---
for an user defined exception using Java.Applications:
(1) Throwing exception for Checking the @ symbol in Email Id
(2) Throwing exception for password mismatch.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
27
Ex. No.: 8
FILE INFORMATION
--- Content provided by FirstRanker.com ---
Aim
To write a Java program that reads a file name from the user, displays information about whether the file
exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Read the filename from the user.
--- Content provided by FirstRanker.com ---
3. Use getName() Method to display the filename.4. Use getPath() Method to display the path of the file.
5. Use getParent() Method to display its parent?s information.
6. Use exists() Method to display whether the file exist or not
7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.
--- Content provided by FirstRanker.com ---
8.Use canRead() and canWrite) methods to display whether the file is readable or writable.9. Use lastModified() Method to display the modified information.
10. Use length() method to display the size of the file.
11. Use isHiddden() Method to display whether the file is hidden or not.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
28
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the information of the file has been displayed successfully using various file methods.
Outcome:
Thus the course outcome (CO1) has been attained y file operations using Java..
--- Content provided by FirstRanker.com ---
Applications:
(1) IRCTC chart display (RAC reservation)
(2) A2B menu display
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
Name : ______________________________________Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious andenterprising professionals conforming to global standards through value based quality education and
training.
? To provide competent technical manpower capable of meeting requirements of the
--- Content provided by FirstRanker.com ---
Industry? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineeringthrough quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
--- Content provided by FirstRanker.com ---
To impart students with fundamental knowledge in Mathematics, Science and fundamentals ofengineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
--- Content provided by FirstRanker.com ---
3. BREADTHTo provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
--- Content provided by FirstRanker.com ---
To bestow students with adequate training and provide opportunities to work as team that will buildup their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
--- Content provided by FirstRanker.com ---
and Engineering and to create awareness about the need for lifelong learning and pursuing advanceddegrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
--- Content provided by FirstRanker.com ---
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals inComputer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
--- Content provided by FirstRanker.com ---
d) To understand a complex real world problem and develop an efficient practical solutione) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
--- Content provided by FirstRanker.com ---
h) To communicate effectively and make others understand exactly what they are trying to convey inboth verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
--- Content provided by FirstRanker.com ---
k) To develop and manage projects in multidisciplinary environment9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORYSYLLABUS
? To build software development skills using java programming for real-world applications.
--- Content provided by FirstRanker.com ---
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
? To develop applications using generic programming and event handling.
--- Content provided by FirstRanker.com ---
LIST OF EXPERIMENTS:1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
following tariff.
--- Content provided by FirstRanker.com ---
If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INRand vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
10
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
--- Content provided by FirstRanker.com ---
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professorfrom employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
--- Content provided by FirstRanker.com ---
necessary exception handling in both the implementations.5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
b. Insert ? add at particular index
--- Content provided by FirstRanker.com ---
c. Searchd. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
--- Content provided by FirstRanker.com ---
Shape. Each one of the classes contains only the method print Area () that prints thearea of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
--- Content provided by FirstRanker.com ---
length of the file in bytes.9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
--- Content provided by FirstRanker.com ---
10. Write a java program to find the maximum value from the given type of elements using ageneric function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
b) Scientific manipulations
--- Content provided by FirstRanker.com ---
12. Develop a mini project for any application using Java concepts.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
--- Content provided by FirstRanker.com ---
2 Currency converter , Distance converter and Time converter 153 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
6 Abstract Class 23
--- Content provided by FirstRanker.com ---
7 Exception Handling 258 File Information 27
9 Multithreading 29
10 Generic Function 31
11 Calculator 33
--- Content provided by FirstRanker.com ---
12 Mini Project ? Vehicle Management System 36--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
ELECTRICITY BILL GENERATION
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs.1 per unit? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 2 per unit? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount6. Stop the program
14
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
--- Content provided by FirstRanker.com ---
Java.Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
--- Content provided by FirstRanker.com ---
Ex. No.:2
Currency Converter, Distance Converter and Time Converter
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application to implement currency converter , distance converter and time converterusing packages.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created for currency conversion, distance conversion and timeconversion and it was successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Kilogram to gram conversion(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
Ex. No.:3
--- Content provided by FirstRanker.com ---
PAYROLL PROCESSINGAim:
To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
--- Content provided by FirstRanker.com ---
members.3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
--- Content provided by FirstRanker.com ---
5. Generate pay slips for the employees with their gross and net salary.6. Stop the program
--- Content provided by FirstRanker.com ---
18
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Java application has been created with with employee class and pay slips are generated for
--- Content provided by FirstRanker.com ---
the employees with their gross and net salary.Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) EB Bill Generation(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
Ex. No.:4
ADT STACK
--- Content provided by FirstRanker.com ---
AimTo design a Java interface for ADT Stack using array.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Define the interface.
3. Read the elements using array.
4. Initialize stackTop pointer as zero,
--- Content provided by FirstRanker.com ---
5. Define and use the method Push() to insert the elements into the stack with ?STACKOVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the design and implementation of ADT Stack using array has successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) ADT Queue(2) ADT circular queue
--- Content provided by FirstRanker.com ---
21
Ex. No.:5
--- Content provided by FirstRanker.com ---
STRING OPERATIONSAim
To write a program to perform string operations using ArrayList.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Add the String as an object to List.
--- Content provided by FirstRanker.com ---
3. Get the choice from the user and do according to the choicea. Append-add at end
b. Insert-add at particular index
c. Search
d. List all string starts with given letter.
--- Content provided by FirstRanker.com ---
3. Display the result4. Stop the program.
--- Content provided by FirstRanker.com ---
22
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the implementation of string operations using array list has been successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) Reverse of the String.(2) String Matching.
(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
23Ex. No.:6
ABSTRACT CLASS
Aim
--- Content provided by FirstRanker.com ---
To write a Java Program to create an abstract class named Shape and provide three classes namedRectangle, Triangle and Circle such that each one of the classes extends the class Shape.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the abstract class shape.
--- Content provided by FirstRanker.com ---
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the design and implementation of Abstract class has been successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) Volume of the Cube(2) Length of the Cube
(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25
Ex. No.:7
EXCEPTION HANDLING
--- Content provided by FirstRanker.com ---
AimTo write a Java program to implement user defined exception handling.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the exception for getting a number from the user.
--- Content provided by FirstRanker.com ---
3. If the number is positive print the number as such.4. If the number is negative throw the exception to the user as ?Number must be
positive?.
5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the user defined exception has been successfully implemented.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of Exception handlingfor an user defined exception using Java.
Applications:
(1) Throwing exception for Checking the @ symbol in Email Id
(2) Throwing exception for password mismatch.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
27
Ex. No.: 8
--- Content provided by FirstRanker.com ---
FILE INFORMATIONAim
To write a Java program that reads a file name from the user, displays information about whether the file
exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Read the filename from the user.3. Use getName() Method to display the filename.
4. Use getPath() Method to display the path of the file.
5. Use getParent() Method to display its parent?s information.
6. Use exists() Method to display whether the file exist or not
--- Content provided by FirstRanker.com ---
7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.8.Use canRead() and canWrite) methods to display whether the file is readable or writable.
9. Use lastModified() Method to display the modified information.
10. Use length() method to display the size of the file.
11. Use isHiddden() Method to display whether the file is hidden or not.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
28
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the information of the file has been displayed successfully using various file methods.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained y file operations using Java..Applications:
(1) IRCTC chart display (RAC reservation)
(2) A2B menu display
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
29
--- Content provided by FirstRanker.com ---
Ex. No.: 9MULTITHREADING
Aim
To write a java program that implements a multi-threaded application.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Design the first thread that generates a random integer for every 1 second .
3. If the first thread value is even, design the second thread as the square of the number
and then print it.
4.If the first thread value is odd, then third thread will print the value of cube of the
--- Content provided by FirstRanker.com ---
number.5. Stop the program.
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGCS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
--- Content provided by FirstRanker.com ---
Section : ______________________________________--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
--- Content provided by FirstRanker.com ---
training.? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
--- Content provided by FirstRanker.com ---
Education at different levels? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
--- Content provided by FirstRanker.com ---
2. CORE COMPETENCETo provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
--- Content provided by FirstRanker.com ---
enables them to find solutions for real time problems in industry and organization, and to design productsrequiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
--- Content provided by FirstRanker.com ---
and work in ever changing technologies5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
--- Content provided by FirstRanker.com ---
b) To design and conduct experiments as well as to analyze and interpret and apply the same in thecareer
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
--- Content provided by FirstRanker.com ---
f) To understand their roles as a professionals and give the best to the societyg) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
--- Content provided by FirstRanker.com ---
i) To work in a team as team member or a leader and make unique contributions and work withcoordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
--- Content provided by FirstRanker.com ---
and file processing.? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
--- Content provided by FirstRanker.com ---
Consumer no., consumer name, previous month reading, current month reading, type of EB connection(i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 2.50 per unit? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 4.50 per unit? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
--- Content provided by FirstRanker.com ---
(hours to minutes, seconds and vice versa) using packages.COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
103. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
--- Content provided by FirstRanker.com ---
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BPfor staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
--- Content provided by FirstRanker.com ---
for the followinga. Append - add at end
b. Insert ? add at particular index
c. Search
d. List all string starts with given letter
--- Content provided by FirstRanker.com ---
6. Write a Java Program to create an abstract class named Shape that contains twointegers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
--- Content provided by FirstRanker.com ---
7. Write a Java program to implement user defined exception handling.8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
--- Content provided by FirstRanker.com ---
First thread generates a random integer every 1 second and if the value is even, secondthread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
--- Content provided by FirstRanker.com ---
11. Design a calculator using event-driven programming paradigm of Java with thefollowing options.
11
--- Content provided by FirstRanker.com ---
a) Decimal manipulations
b) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
INDEXSl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
--- Content provided by FirstRanker.com ---
4 ADT Stack 195 String Operations 21
6 Abstract Class 23
7 Exception Handling 25
8 File Information 27
--- Content provided by FirstRanker.com ---
9 Multithreading 2910 Generic Function 31
11 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
--- Content provided by FirstRanker.com ---
Ex. No.:1
ELECTRICITY BILL GENERATION
Aim:
To develop a Java application to generate Electricity bill.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
--- Content provided by FirstRanker.com ---
previous month reading, current month reading, type of EB connection (i.e domestic orcommercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 4 per unit? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 6 per unit? > 501 units - Rs. 7 per unit
5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Electricity Bill Java application was successfully executed.Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Payroll Processing(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
Ex. No.:2
--- Content provided by FirstRanker.com ---
Currency Converter, Distance Converter and Time Converter
Aim:
To develop a Java application to implement currency converter , distance converter and time converter
using packages.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
--- Content provided by FirstRanker.com ---
3. Create corresponding code for conversion4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
17Ex. No.:3
PAYROLL PROCESSING
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application with employee class and generate pay slips for the employees with theirgross and net salary.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
members.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
--- Content provided by FirstRanker.com ---
from employee class.4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
18
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created with with employee class and pay slips are generated for
the employees with their gross and net salary.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained by applying the concept of inheritance togenerate Payroll Processing application using Java.
Applications:
(1) EB Bill Generation
(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
--- Content provided by FirstRanker.com ---
Ex. No.:4
ADT STACK
Aim
To design a Java interface for ADT Stack using array.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the interface.3. Read the elements using array.
4. Initialize stackTop pointer as zero,
5. Define and use the method Push() to insert the elements into the stack with ?STACK
OVERFLOW? condition.
--- Content provided by FirstRanker.com ---
6. Define and use the method pop() to remove an element from an array with ?STACKUNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the design and implementation of ADT Stack using array has successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of array to generate
--- Content provided by FirstRanker.com ---
ADT Stack using Java.Applications:
(1) ADT Queue
(2) ADT circular queue
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
21Ex. No.:5
STRING OPERATIONS
Aim
--- Content provided by FirstRanker.com ---
To write a program to perform string operations using ArrayList.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Add the String as an object to List.
3. Get the choice from the user and do according to the choice
a. Append-add at end
--- Content provided by FirstRanker.com ---
b. Insert-add at particular indexc. Search
d. List all string starts with given letter.
3. Display the result
4. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
22
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of string operations using array list has been successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for stringmanipulations using Java.
Applications:
(1) Reverse of the String.
(2) String Matching.
--- Content provided by FirstRanker.com ---
(3) Counting the number of vowels and consonants in a line.--- Content provided by FirstRanker.com ---
23
--- Content provided by FirstRanker.com ---
Ex. No.:6ABSTRACT CLASS
Aim
To write a Java Program to create an abstract class named Shape and provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.
--- Content provided by FirstRanker.com ---
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Define the abstract class shape.
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
--- Content provided by FirstRanker.com ---
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.6. Print the area of the Rectangle,Triangle and Circle .
7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the design and implementation of Abstract class has been successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of abstract class usingJava.
Applications:
(1) Volume of the Cube
(2) Length of the Cube
--- Content provided by FirstRanker.com ---
(3) Area of Triangle--- Content provided by FirstRanker.com ---
25
--- Content provided by FirstRanker.com ---
Ex. No.:7
EXCEPTION HANDLING
Aim
To write a Java program to implement user defined exception handling.
--- Content provided by FirstRanker.com ---
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Define the exception for getting a number from the user.
3. If the number is positive print the number as such.
4. If the number is negative throw the exception to the user as ?Number must be
--- Content provided by FirstRanker.com ---
positive?.5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the user defined exception has been successfully implemented.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of Exception handling
for an user defined exception using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) Throwing exception for Checking the @ symbol in Email Id
(2) Throwing exception for password mismatch.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
27Ex. No.: 8
FILE INFORMATION
--- Content provided by FirstRanker.com ---
AimTo write a Java program that reads a file name from the user, displays information about whether the file
exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Read the filename from the user.
3. Use getName() Method to display the filename.
--- Content provided by FirstRanker.com ---
4. Use getPath() Method to display the path of the file.5. Use getParent() Method to display its parent?s information.
6. Use exists() Method to display whether the file exist or not
7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.
8.Use canRead() and canWrite) methods to display whether the file is readable or writable.
--- Content provided by FirstRanker.com ---
9. Use lastModified() Method to display the modified information.10. Use length() method to display the size of the file.
11. Use isHiddden() Method to display whether the file is hidden or not.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
28
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the information of the file has been displayed successfully using various file methods.
Outcome:
Thus the course outcome (CO1) has been attained y file operations using Java..
--- Content provided by FirstRanker.com ---
Applications:(1) IRCTC chart display (RAC reservation)
(2) A2B menu display
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
29Ex. No.: 9
MULTITHREADING
--- Content provided by FirstRanker.com ---
Aim
To write a java program that implements a multi-threaded application.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Design the first thread that generates a random integer for every 1 second .
--- Content provided by FirstRanker.com ---
3. If the first thread value is even, design the second thread as the square of the numberand then print it.
4.If the first thread value is odd, then third thread will print the value of cube of the
number.
5. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
30
--- Content provided by FirstRanker.com ---
Sample output:Result:
--- Content provided by FirstRanker.com ---
Thus the implementation of multithreading has been done using three threads.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of multithreading to
generate odd numbers and its square using Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Multiplication Table Printing (3,5,8
th
table)
(2) Printing Area of the cube, square and circle
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
Name : ______________________________________Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious andenterprising professionals conforming to global standards through value based quality education and
training.
? To provide competent technical manpower capable of meeting requirements of the
--- Content provided by FirstRanker.com ---
Industry? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineeringthrough quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
--- Content provided by FirstRanker.com ---
To impart students with fundamental knowledge in Mathematics, Science and fundamentals ofengineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
--- Content provided by FirstRanker.com ---
3. BREADTHTo provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
--- Content provided by FirstRanker.com ---
To bestow students with adequate training and provide opportunities to work as team that will buildup their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
--- Content provided by FirstRanker.com ---
and Engineering and to create awareness about the need for lifelong learning and pursuing advanceddegrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
--- Content provided by FirstRanker.com ---
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals inComputer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
--- Content provided by FirstRanker.com ---
d) To understand a complex real world problem and develop an efficient practical solutione) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
--- Content provided by FirstRanker.com ---
h) To communicate effectively and make others understand exactly what they are trying to convey inboth verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
--- Content provided by FirstRanker.com ---
k) To develop and manage projects in multidisciplinary environment9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORYSYLLABUS
? To build software development skills using java programming for real-world applications.
--- Content provided by FirstRanker.com ---
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
? To develop applications using generic programming and event handling.
--- Content provided by FirstRanker.com ---
LIST OF EXPERIMENTS:1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
following tariff.
--- Content provided by FirstRanker.com ---
If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INRand vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
10
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
--- Content provided by FirstRanker.com ---
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professorfrom employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
--- Content provided by FirstRanker.com ---
necessary exception handling in both the implementations.5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
b. Insert ? add at particular index
--- Content provided by FirstRanker.com ---
c. Searchd. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
--- Content provided by FirstRanker.com ---
Shape. Each one of the classes contains only the method print Area () that prints thearea of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
--- Content provided by FirstRanker.com ---
length of the file in bytes.9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
--- Content provided by FirstRanker.com ---
10. Write a java program to find the maximum value from the given type of elements using ageneric function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
b) Scientific manipulations
--- Content provided by FirstRanker.com ---
12. Develop a mini project for any application using Java concepts.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
--- Content provided by FirstRanker.com ---
2 Currency converter , Distance converter and Time converter 153 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
6 Abstract Class 23
--- Content provided by FirstRanker.com ---
7 Exception Handling 258 File Information 27
9 Multithreading 29
10 Generic Function 31
11 Calculator 33
--- Content provided by FirstRanker.com ---
12 Mini Project ? Vehicle Management System 36--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
ELECTRICITY BILL GENERATION
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs.1 per unit? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 2 per unit? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount6. Stop the program
14
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
--- Content provided by FirstRanker.com ---
Java.Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
--- Content provided by FirstRanker.com ---
Ex. No.:2
Currency Converter, Distance Converter and Time Converter
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application to implement currency converter , distance converter and time converterusing packages.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created for currency conversion, distance conversion and timeconversion and it was successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Kilogram to gram conversion(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
Ex. No.:3
--- Content provided by FirstRanker.com ---
PAYROLL PROCESSINGAim:
To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
--- Content provided by FirstRanker.com ---
members.3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
--- Content provided by FirstRanker.com ---
5. Generate pay slips for the employees with their gross and net salary.6. Stop the program
--- Content provided by FirstRanker.com ---
18
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Java application has been created with with employee class and pay slips are generated for
--- Content provided by FirstRanker.com ---
the employees with their gross and net salary.Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) EB Bill Generation(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
Ex. No.:4
ADT STACK
--- Content provided by FirstRanker.com ---
AimTo design a Java interface for ADT Stack using array.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Define the interface.
3. Read the elements using array.
4. Initialize stackTop pointer as zero,
--- Content provided by FirstRanker.com ---
5. Define and use the method Push() to insert the elements into the stack with ?STACKOVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the design and implementation of ADT Stack using array has successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) ADT Queue(2) ADT circular queue
--- Content provided by FirstRanker.com ---
21
Ex. No.:5
--- Content provided by FirstRanker.com ---
STRING OPERATIONSAim
To write a program to perform string operations using ArrayList.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Add the String as an object to List.
--- Content provided by FirstRanker.com ---
3. Get the choice from the user and do according to the choicea. Append-add at end
b. Insert-add at particular index
c. Search
d. List all string starts with given letter.
--- Content provided by FirstRanker.com ---
3. Display the result4. Stop the program.
--- Content provided by FirstRanker.com ---
22
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the implementation of string operations using array list has been successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) Reverse of the String.(2) String Matching.
(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
23Ex. No.:6
ABSTRACT CLASS
Aim
--- Content provided by FirstRanker.com ---
To write a Java Program to create an abstract class named Shape and provide three classes namedRectangle, Triangle and Circle such that each one of the classes extends the class Shape.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the abstract class shape.
--- Content provided by FirstRanker.com ---
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the design and implementation of Abstract class has been successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) Volume of the Cube(2) Length of the Cube
(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25
Ex. No.:7
EXCEPTION HANDLING
--- Content provided by FirstRanker.com ---
AimTo write a Java program to implement user defined exception handling.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the exception for getting a number from the user.
--- Content provided by FirstRanker.com ---
3. If the number is positive print the number as such.4. If the number is negative throw the exception to the user as ?Number must be
positive?.
5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the user defined exception has been successfully implemented.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of Exception handlingfor an user defined exception using Java.
Applications:
(1) Throwing exception for Checking the @ symbol in Email Id
(2) Throwing exception for password mismatch.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
27
Ex. No.: 8
--- Content provided by FirstRanker.com ---
FILE INFORMATIONAim
To write a Java program that reads a file name from the user, displays information about whether the file
exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Read the filename from the user.3. Use getName() Method to display the filename.
4. Use getPath() Method to display the path of the file.
5. Use getParent() Method to display its parent?s information.
6. Use exists() Method to display whether the file exist or not
--- Content provided by FirstRanker.com ---
7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.8.Use canRead() and canWrite) methods to display whether the file is readable or writable.
9. Use lastModified() Method to display the modified information.
10. Use length() method to display the size of the file.
11. Use isHiddden() Method to display whether the file is hidden or not.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
28
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the information of the file has been displayed successfully using various file methods.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained y file operations using Java..Applications:
(1) IRCTC chart display (RAC reservation)
(2) A2B menu display
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
29
--- Content provided by FirstRanker.com ---
Ex. No.: 9MULTITHREADING
Aim
To write a java program that implements a multi-threaded application.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Design the first thread that generates a random integer for every 1 second .
3. If the first thread value is even, design the second thread as the square of the number
and then print it.
4.If the first thread value is odd, then third thread will print the value of cube of the
--- Content provided by FirstRanker.com ---
number.5. Stop the program.
--- Content provided by FirstRanker.com ---
30
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of multithreading has been done using three threads.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of multithreading to
--- Content provided by FirstRanker.com ---
generate odd numbers and its square using Java.Applications :
(1) Multiplication Table Printing (3,5,8
th
--- Content provided by FirstRanker.com ---
table)(2) Printing Area of the cube, square and circle
--- Content provided by FirstRanker.com ---
31
--- Content provided by FirstRanker.com ---
Ex. No.: 10GENERIC FUNCTION
Aim
To write a java program to find the maximum value from the given type of elements using a generic
function.
--- Content provided by FirstRanker.com ---
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Define the array with the elements
3. Sets the first value in the array as the current maximum
4. Find the maximum value by comparing each elements of the array
--- Content provided by FirstRanker.com ---
5. Display the maximum value6. Stop the program.
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
--- Content provided by FirstRanker.com ---
Reg. No. : ______________________________________Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5is committed to provide highly disciplined, conscientious and
--- Content provided by FirstRanker.com ---
enterprising professionals conforming to global standards through value based quality education andtraining.
? To provide competent technical manpower capable of meeting requirements of the
Industry
--- Content provided by FirstRanker.com ---
? To contribute to the promotion of Academic Excellence in pursuit of TechnicalEducation at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
--- Content provided by FirstRanker.com ---
through quality education and to provide enthusiastic professionals with commitment? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
--- Content provided by FirstRanker.com ---
engineering that will mould them to be successful professionals2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
--- Content provided by FirstRanker.com ---
To provide relevant training and experience to bridge the gap between theory and practice whichenables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
--- Content provided by FirstRanker.com ---
up their communication skills, individual leadership and supportive qualities, and to enable them to adaptand work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
--- Content provided by FirstRanker.com ---
degrees--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
--- Content provided by FirstRanker.com ---
Computer Science and Engineering fieldb) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
--- Content provided by FirstRanker.com ---
e) To create, select and apply appropriate techniques, resources, modern engineering and IT toolsf) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
--- Content provided by FirstRanker.com ---
both verbal and written formsi) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9
CS8383 ?OBJECT ORIENTED LABORATORY
--- Content provided by FirstRanker.com ---
SYLLABUS? To build software development skills using java programming for real-world applications.
--- Content provided by FirstRanker.com ---
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handlingand file processing.
? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
--- Content provided by FirstRanker.com ---
1. Develop a Java application to generate Electricity bill. Create a class with the following members:Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 1 per unit? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 2 per unit? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
--- Content provided by FirstRanker.com ---
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter(hours to minutes, seconds and vice versa) using packages.
COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
10
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
--- Content provided by FirstRanker.com ---
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP asDA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
--- Content provided by FirstRanker.com ---
5. Write a program to perform string operations using ArrayList. Write functionsfor the following
a. Append - add at end
b. Insert ? add at particular index
c. Search
--- Content provided by FirstRanker.com ---
d. List all string starts with given letter6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
--- Content provided by FirstRanker.com ---
area of the given shape.7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
--- Content provided by FirstRanker.com ---
9. Write a java program that implements a multi-threaded application that has three threads.First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
--- Content provided by FirstRanker.com ---
generic function.11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11a) Decimal manipulations
b) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORYINDEX
Sl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
--- Content provided by FirstRanker.com ---
3 Payroll Processing 184 ADT Stack 19
5 String Operations 21
6 Abstract Class 23
7 Exception Handling 25
--- Content provided by FirstRanker.com ---
8 File Information 279 Multithreading 29
10 Generic Function 31
11 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13Ex. No.:1
ELECTRICITY BILL GENERATION
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application to generate Electricity bill.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create consumer class with the following members: Consumer no., consumer name,previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs.2.50 per unit? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 4.50 per unit? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
5. Print the amount
--- Content provided by FirstRanker.com ---
6. Stop the program14
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
--- Content provided by FirstRanker.com ---
Applications :(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
--- Content provided by FirstRanker.com ---
Ex. No.:2Currency Converter, Distance Converter and Time Converter
Aim:
To develop a Java application to implement currency converter , distance converter and time converter
--- Content provided by FirstRanker.com ---
using packages.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create three packages for currency converter , distance converter and time converter.3. Create corresponding code for conversion
4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Java application has been created for currency conversion, distance conversion and time
--- Content provided by FirstRanker.com ---
conversion and it was successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
(1) Kilogram to gram conversion
--- Content provided by FirstRanker.com ---
(2) Celsius to Fahrenheit conversion--- Content provided by FirstRanker.com ---
17
Ex. No.:3
PAYROLL PROCESSING
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
members.
--- Content provided by FirstRanker.com ---
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professorfrom employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
5. Generate pay slips for the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
6. Stop the program--- Content provided by FirstRanker.com ---
18
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created with with employee class and pay slips are generated for
the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
Applications:
(1) EB Bill Generation
--- Content provided by FirstRanker.com ---
(2) Income Tax Calculation--- Content provided by FirstRanker.com ---
19Ex. No.:4
ADT STACK
Aim
--- Content provided by FirstRanker.com ---
To design a Java interface for ADT Stack using array.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Define the interface.
3. Read the elements using array.
4. Initialize stackTop pointer as zero,
5. Define and use the method Push() to insert the elements into the stack with ?STACK
--- Content provided by FirstRanker.com ---
OVERFLOW? condition.6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the design and implementation of ADT Stack using array has successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of array to generateADT Stack using Java.
Applications:
(1) ADT Queue
--- Content provided by FirstRanker.com ---
(2) ADT circular queue--- Content provided by FirstRanker.com ---
21
Ex. No.:5
STRING OPERATIONS
--- Content provided by FirstRanker.com ---
AimTo write a program to perform string operations using ArrayList.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Add the String as an object to List.
3. Get the choice from the user and do according to the choice
--- Content provided by FirstRanker.com ---
a. Append-add at endb. Insert-add at particular index
c. Search
d. List all string starts with given letter.
3. Display the result
--- Content provided by FirstRanker.com ---
4. Stop the program.--- Content provided by FirstRanker.com ---
22
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the implementation of string operations using array list has been successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
Applications:
(1) Reverse of the String.
--- Content provided by FirstRanker.com ---
(2) String Matching.(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
23
--- Content provided by FirstRanker.com ---
Ex. No.:6
ABSTRACT CLASS
Aim
To write a Java Program to create an abstract class named Shape and provide three classes named
--- Content provided by FirstRanker.com ---
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Define the abstract class shape.
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
--- Content provided by FirstRanker.com ---
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
--- Content provided by FirstRanker.com ---
Sample output:
Result:
Thus the design and implementation of Abstract class has been successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
Java.
Applications:
(1) Volume of the Cube
--- Content provided by FirstRanker.com ---
(2) Length of the Cube(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25Ex. No.:7
EXCEPTION HANDLING
Aim
--- Content provided by FirstRanker.com ---
To write a Java program to implement user defined exception handling.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Define the exception for getting a number from the user.
3. If the number is positive print the number as such.
--- Content provided by FirstRanker.com ---
4. If the number is negative throw the exception to the user as ?Number must bepositive?.
5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the user defined exception has been successfully implemented.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of Exception handling
--- Content provided by FirstRanker.com ---
for an user defined exception using Java.Applications:
(1) Throwing exception for Checking the @ symbol in Email Id
(2) Throwing exception for password mismatch.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
27
Ex. No.: 8
FILE INFORMATION
--- Content provided by FirstRanker.com ---
Aim
To write a Java program that reads a file name from the user, displays information about whether the file
exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Read the filename from the user.
--- Content provided by FirstRanker.com ---
3. Use getName() Method to display the filename.4. Use getPath() Method to display the path of the file.
5. Use getParent() Method to display its parent?s information.
6. Use exists() Method to display whether the file exist or not
7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.
--- Content provided by FirstRanker.com ---
8.Use canRead() and canWrite) methods to display whether the file is readable or writable.9. Use lastModified() Method to display the modified information.
10. Use length() method to display the size of the file.
11. Use isHiddden() Method to display whether the file is hidden or not.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
28
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the information of the file has been displayed successfully using various file methods.
Outcome:
Thus the course outcome (CO1) has been attained y file operations using Java..
--- Content provided by FirstRanker.com ---
Applications:
(1) IRCTC chart display (RAC reservation)
(2) A2B menu display
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
29
Ex. No.: 9
--- Content provided by FirstRanker.com ---
MULTITHREADINGAim
To write a java program that implements a multi-threaded application.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Design the first thread that generates a random integer for every 1 second .3. If the first thread value is even, design the second thread as the square of the number
and then print it.
4.If the first thread value is odd, then third thread will print the value of cube of the
number.
--- Content provided by FirstRanker.com ---
5. Stop the program.--- Content provided by FirstRanker.com ---
30
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the implementation of multithreading has been done using three threads.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of multithreading to
generate odd numbers and its square using Java.
--- Content provided by FirstRanker.com ---
Applications :(1) Multiplication Table Printing (3,5,8
th
table)
--- Content provided by FirstRanker.com ---
(2) Printing Area of the cube, square and circle--- Content provided by FirstRanker.com ---
31
Ex. No.: 10
--- Content provided by FirstRanker.com ---
GENERIC FUNCTIONAim
To write a java program to find the maximum value from the given type of elements using a generic
function.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Define the array with the elements
3. Sets the first value in the array as the current maximum
4. Find the maximum value by comparing each elements of the array
5. Display the maximum value
--- Content provided by FirstRanker.com ---
6. Stop the program.--- Content provided by FirstRanker.com ---
32
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of generic function is achieved for finding the maximum value from the given
type of elements.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO3) has been attained by applying the concept of generic function togenerate maximum value and minimum value. .
Applications:
(1) Finding even values
--- Content provided by FirstRanker.com ---
(2). Finding the sum of valuesFirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGCS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
--- Content provided by FirstRanker.com ---
Section : ______________________________________--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
--- Content provided by FirstRanker.com ---
training.? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
--- Content provided by FirstRanker.com ---
Education at different levels? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices.
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
--- Content provided by FirstRanker.com ---
innovation and ethical practices--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISIONMISSION
7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
--- Content provided by FirstRanker.com ---
2. CORE COMPETENCETo provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
--- Content provided by FirstRanker.com ---
enables them to find solutions for real time problems in industry and organization, and to design productsrequiring interdisciplinary skills
4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
--- Content provided by FirstRanker.com ---
and work in ever changing technologies5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
--- Content provided by FirstRanker.com ---
b) To design and conduct experiments as well as to analyze and interpret and apply the same in thecareer
c) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
--- Content provided by FirstRanker.com ---
f) To understand their roles as a professionals and give the best to the societyg) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
--- Content provided by FirstRanker.com ---
i) To work in a team as team member or a leader and make unique contributions and work withcoordination
j) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
--- Content provided by FirstRanker.com ---
and file processing.? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
--- Content provided by FirstRanker.com ---
Consumer no., consumer name, previous month reading, current month reading, type of EB connection(i.e domestic or commercial). Compute the bill amount using the
following tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 2.50 per unit? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
--- Content provided by FirstRanker.com ---
? 101-200 units - Rs. 4.50 per unit? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
--- Content provided by FirstRanker.com ---
(hours to minutes, seconds and vice versa) using packages.COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
103. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
--- Content provided by FirstRanker.com ---
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BPfor staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
--- Content provided by FirstRanker.com ---
for the followinga. Append - add at end
b. Insert ? add at particular index
c. Search
d. List all string starts with given letter
--- Content provided by FirstRanker.com ---
6. Write a Java Program to create an abstract class named Shape that contains twointegers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
--- Content provided by FirstRanker.com ---
7. Write a Java program to implement user defined exception handling.8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
--- Content provided by FirstRanker.com ---
First thread generates a random integer every 1 second and if the value is even, secondthread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
--- Content provided by FirstRanker.com ---
11. Design a calculator using event-driven programming paradigm of Java with thefollowing options.
11
--- Content provided by FirstRanker.com ---
a) Decimal manipulations
b) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
INDEXSl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
--- Content provided by FirstRanker.com ---
4 ADT Stack 195 String Operations 21
6 Abstract Class 23
7 Exception Handling 25
8 File Information 27
--- Content provided by FirstRanker.com ---
9 Multithreading 2910 Generic Function 31
11 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
--- Content provided by FirstRanker.com ---
Ex. No.:1
ELECTRICITY BILL GENERATION
Aim:
To develop a Java application to generate Electricity bill.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
--- Content provided by FirstRanker.com ---
previous month reading, current month reading, type of EB connection (i.e domestic orcommercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 4 per unit? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 6 per unit? > 501 units - Rs. 7 per unit
5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Electricity Bill Java application was successfully executed.Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Payroll Processing(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
Ex. No.:2
--- Content provided by FirstRanker.com ---
Currency Converter, Distance Converter and Time Converter
Aim:
To develop a Java application to implement currency converter , distance converter and time converter
using packages.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
--- Content provided by FirstRanker.com ---
3. Create corresponding code for conversion4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
17Ex. No.:3
PAYROLL PROCESSING
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application with employee class and generate pay slips for the employees with theirgross and net salary.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
members.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
--- Content provided by FirstRanker.com ---
from employee class.4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
18
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created with with employee class and pay slips are generated for
the employees with their gross and net salary.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained by applying the concept of inheritance togenerate Payroll Processing application using Java.
Applications:
(1) EB Bill Generation
(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
--- Content provided by FirstRanker.com ---
Ex. No.:4
ADT STACK
Aim
To design a Java interface for ADT Stack using array.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the interface.3. Read the elements using array.
4. Initialize stackTop pointer as zero,
5. Define and use the method Push() to insert the elements into the stack with ?STACK
OVERFLOW? condition.
--- Content provided by FirstRanker.com ---
6. Define and use the method pop() to remove an element from an array with ?STACKUNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the design and implementation of ADT Stack using array has successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of array to generate
--- Content provided by FirstRanker.com ---
ADT Stack using Java.Applications:
(1) ADT Queue
(2) ADT circular queue
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
21Ex. No.:5
STRING OPERATIONS
Aim
--- Content provided by FirstRanker.com ---
To write a program to perform string operations using ArrayList.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Add the String as an object to List.
3. Get the choice from the user and do according to the choice
a. Append-add at end
--- Content provided by FirstRanker.com ---
b. Insert-add at particular indexc. Search
d. List all string starts with given letter.
3. Display the result
4. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
22
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of string operations using array list has been successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for stringmanipulations using Java.
Applications:
(1) Reverse of the String.
(2) String Matching.
--- Content provided by FirstRanker.com ---
(3) Counting the number of vowels and consonants in a line.--- Content provided by FirstRanker.com ---
23
--- Content provided by FirstRanker.com ---
Ex. No.:6ABSTRACT CLASS
Aim
To write a Java Program to create an abstract class named Shape and provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.
--- Content provided by FirstRanker.com ---
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Define the abstract class shape.
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
--- Content provided by FirstRanker.com ---
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.6. Print the area of the Rectangle,Triangle and Circle .
7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the design and implementation of Abstract class has been successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of abstract class usingJava.
Applications:
(1) Volume of the Cube
(2) Length of the Cube
--- Content provided by FirstRanker.com ---
(3) Area of Triangle--- Content provided by FirstRanker.com ---
25
--- Content provided by FirstRanker.com ---
Ex. No.:7
EXCEPTION HANDLING
Aim
To write a Java program to implement user defined exception handling.
--- Content provided by FirstRanker.com ---
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Define the exception for getting a number from the user.
3. If the number is positive print the number as such.
4. If the number is negative throw the exception to the user as ?Number must be
--- Content provided by FirstRanker.com ---
positive?.5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the user defined exception has been successfully implemented.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of Exception handling
for an user defined exception using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) Throwing exception for Checking the @ symbol in Email Id
(2) Throwing exception for password mismatch.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
27Ex. No.: 8
FILE INFORMATION
--- Content provided by FirstRanker.com ---
AimTo write a Java program that reads a file name from the user, displays information about whether the file
exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Read the filename from the user.
3. Use getName() Method to display the filename.
--- Content provided by FirstRanker.com ---
4. Use getPath() Method to display the path of the file.5. Use getParent() Method to display its parent?s information.
6. Use exists() Method to display whether the file exist or not
7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.
8.Use canRead() and canWrite) methods to display whether the file is readable or writable.
--- Content provided by FirstRanker.com ---
9. Use lastModified() Method to display the modified information.10. Use length() method to display the size of the file.
11. Use isHiddden() Method to display whether the file is hidden or not.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
28
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the information of the file has been displayed successfully using various file methods.
Outcome:
Thus the course outcome (CO1) has been attained y file operations using Java..
--- Content provided by FirstRanker.com ---
Applications:(1) IRCTC chart display (RAC reservation)
(2) A2B menu display
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
29Ex. No.: 9
MULTITHREADING
--- Content provided by FirstRanker.com ---
Aim
To write a java program that implements a multi-threaded application.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Design the first thread that generates a random integer for every 1 second .
--- Content provided by FirstRanker.com ---
3. If the first thread value is even, design the second thread as the square of the numberand then print it.
4.If the first thread value is odd, then third thread will print the value of cube of the
number.
5. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
30
--- Content provided by FirstRanker.com ---
Sample output:Result:
--- Content provided by FirstRanker.com ---
Thus the implementation of multithreading has been done using three threads.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of multithreading to
generate odd numbers and its square using Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Multiplication Table Printing (3,5,8
th
table)
(2) Printing Area of the cube, square and circle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
31
Ex. No.: 10
GENERIC FUNCTION
--- Content provided by FirstRanker.com ---
AimTo write a java program to find the maximum value from the given type of elements using a generic
function.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the array with the elements3. Sets the first value in the array as the current maximum
4. Find the maximum value by comparing each elements of the array
5. Display the maximum value
6. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
32
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the implementation of generic function is achieved for finding the maximum value from the given
type of elements.
Outcome:
Thus the course outcome (CO3) has been attained by applying the concept of generic function to
--- Content provided by FirstRanker.com ---
generate maximum value and minimum value. .Applications:
(1) Finding even values
(2). Finding the sum of values
--- Content provided by FirstRanker.com ---
33
--- Content provided by FirstRanker.com ---
Ex. No.: 11CALCULATOR
Aim
To design a calculator using event-driven programming paradigm of Java for Decimal manipulations and
Scientific manipulations.
--- Content provided by FirstRanker.com ---
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Using the swing components design the buttons of the calculator
3. Use key events and key listener to listen the events of the calculator.
4. Do the necessary manipulations.
--- Content provided by FirstRanker.com ---
5. Stop the program.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORYIII SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of the
Industry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
--- Content provided by FirstRanker.com ---
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tagon heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION6
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERINGTo strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
--- Content provided by FirstRanker.com ---
electronics industry? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
.? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
--- Content provided by FirstRanker.com ---
MISSION7
--- Content provided by FirstRanker.com ---
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)1. FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
--- Content provided by FirstRanker.com ---
To provide students with sound knowledge in engineering and experimental skills to identifycomplex software problems in industry and to develop practical solutions for them
3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
--- Content provided by FirstRanker.com ---
requiring interdisciplinary skills4. PROFESSIONAL SKILLS
To bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
--- Content provided by FirstRanker.com ---
5. LIFELONG LEARNINGTo develop the ability of students to establish themselves as professionals in Computer Science
and Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
--- Content provided by FirstRanker.com ---
PROGRAMME OUTCOMES (POs)On completion of the B.E. (CSE) degree, the graduates will be able
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
--- Content provided by FirstRanker.com ---
careerc) To design and develop innovative and creative software applications
d) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
--- Content provided by FirstRanker.com ---
g) To develop a system that will meet expected needs within realistic constraints such as economical,environmental, social, political, ethical, safe and sustainable
h) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
--- Content provided by FirstRanker.com ---
coordinationj) To engage in lifelong learning and exhibit their technical skills
k) To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
9CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.
LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
--- Content provided by FirstRanker.com ---
(i.e domestic or commercial). Compute the bill amount using thefollowing tariff.
If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 4 per unit? > 501 units - Rs. 6 per unit
If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
--- Content provided by FirstRanker.com ---
? 201 -500 units - Rs. 6 per unit? > 501 units - Rs. 7 per unit
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES
10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
--- Content provided by FirstRanker.com ---
for staff club fund. Generate pay slips for the employees with their gross and net salary.4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
necessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
--- Content provided by FirstRanker.com ---
a. Append - add at endb. Insert ? add at particular index
c. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
--- Content provided by FirstRanker.com ---
integers and an empty method named print Area(). Provide three classes namedRectangle, Triangle and Circle such that each one of the classes extends the class
Shape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
--- Content provided by FirstRanker.com ---
8. Write a Java program that reads a file name from the user, displays information aboutwhether the file exists, whether the file is readable, or writable, the type of file and the
length of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
--- Content provided by FirstRanker.com ---
thread computes the square of the number and prints. If the value is odd, the third threadwill print the value of cube of the number.
10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
--- Content provided by FirstRanker.com ---
following options.11
--- Content provided by FirstRanker.com ---
a) Decimal manipulationsb) Scientific manipulations
12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
--- Content provided by FirstRanker.com ---
Sl. No. Name of the Experiment Page No.1 Electricity Bill Generation 13
2 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
4 ADT Stack 19
--- Content provided by FirstRanker.com ---
5 String Operations 216 Abstract Class 23
7 Exception Handling 25
8 File Information 27
9 Multithreading 29
--- Content provided by FirstRanker.com ---
10 Generic Function 3111 Calculator 33
12 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
--- Content provided by FirstRanker.com ---
Ex. No.:1ELECTRICITY BILL GENERATION
Aim:
To develop a Java application to generate Electricity bill.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
--- Content provided by FirstRanker.com ---
commercial).3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs.6 per unit4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 7 per unit5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Electricity Bill Java application was successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
Java.
Applications :
(1) Payroll Processing
--- Content provided by FirstRanker.com ---
(2) PF Calculation--- Content provided by FirstRanker.com ---
15
Ex. No.:2
--- Content provided by FirstRanker.com ---
Currency Converter, Distance Converter and Time ConverterAim:
To develop a Java application to implement currency converter , distance converter and time converter
using packages.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
--- Content provided by FirstRanker.com ---
4. Print the converted value.5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.Applications :
(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
--- Content provided by FirstRanker.com ---
Ex. No.:3
PAYROLL PROCESSING
Aim:
To develop a Java application with employee class and generate pay slips for the employees with their
--- Content provided by FirstRanker.com ---
gross and net salary.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
members.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
--- Content provided by FirstRanker.com ---
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
18Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Java application has been created with with employee class and pay slips are generated for
the employees with their gross and net salary.
Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
--- Content provided by FirstRanker.com ---
generate Payroll Processing application using Java.Applications:
(1) EB Bill Generation
(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
--- Content provided by FirstRanker.com ---
Ex. No.:4ADT STACK
Aim
To design a Java interface for ADT Stack using array.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Define the interface.
--- Content provided by FirstRanker.com ---
3. Read the elements using array.4. Initialize stackTop pointer as zero,
5. Define and use the method Push() to insert the elements into the stack with ?STACK
OVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
--- Content provided by FirstRanker.com ---
UNDERFLOW? condition7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the design and implementation of ADT Stack using array has successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
--- Content provided by FirstRanker.com ---
Applications:
(1) ADT Queue
(2) ADT circular queue
--- Content provided by FirstRanker.com ---
21
--- Content provided by FirstRanker.com ---
Ex. No.:5
STRING OPERATIONS
Aim
To write a program to perform string operations using ArrayList.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Add the String as an object to List.
3. Get the choice from the user and do according to the choice
a. Append-add at end
b. Insert-add at particular index
--- Content provided by FirstRanker.com ---
c. Searchd. List all string starts with given letter.
3. Display the result
4. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
22
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of string operations using array list has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
--- Content provided by FirstRanker.com ---
manipulations using Java.Applications:
(1) Reverse of the String.
(2) String Matching.
(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
23
Ex. No.:6
--- Content provided by FirstRanker.com ---
ABSTRACT CLASSAim
To write a Java Program to create an abstract class named Shape and provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Define the abstract class shape.
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
--- Content provided by FirstRanker.com ---
6. Print the area of the Rectangle,Triangle and Circle .7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the design and implementation of Abstract class has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
--- Content provided by FirstRanker.com ---
Java.Applications:
(1) Volume of the Cube
(2) Length of the Cube
(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25
--- Content provided by FirstRanker.com ---
Ex. No.:7EXCEPTION HANDLING
Aim
To write a Java program to implement user defined exception handling.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Define the exception for getting a number from the user.
3. If the number is positive print the number as such.
4. If the number is negative throw the exception to the user as ?Number must be
positive?.
--- Content provided by FirstRanker.com ---
5. Stop the Program.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the user defined exception has been successfully implemented.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of Exception handling
for an user defined exception using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) Throwing exception for Checking the @ symbol in Email Id(2) Throwing exception for password mismatch.
--- Content provided by FirstRanker.com ---
27
--- Content provided by FirstRanker.com ---
Ex. No.: 8
FILE INFORMATION
Aim
--- Content provided by FirstRanker.com ---
To write a Java program that reads a file name from the user, displays information about whether the fileexists, whether the file is readable, or writable, the type of file and the length of the file in bytes.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Read the filename from the user.
3. Use getName() Method to display the filename.
4. Use getPath() Method to display the path of the file.
--- Content provided by FirstRanker.com ---
5. Use getParent() Method to display its parent?s information.6. Use exists() Method to display whether the file exist or not
7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.
8.Use canRead() and canWrite) methods to display whether the file is readable or writable.
9. Use lastModified() Method to display the modified information.
--- Content provided by FirstRanker.com ---
10. Use length() method to display the size of the file.11. Use isHiddden() Method to display whether the file is hidden or not.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
28Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the information of the file has been displayed successfully using various file methods.Outcome:
Thus the course outcome (CO1) has been attained y file operations using Java..
Applications:
--- Content provided by FirstRanker.com ---
(1) IRCTC chart display (RAC reservation)(2) A2B menu display
--- Content provided by FirstRanker.com ---
29
--- Content provided by FirstRanker.com ---
Ex. No.: 9
MULTITHREADING
--- Content provided by FirstRanker.com ---
AimTo write a java program that implements a multi-threaded application.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Design the first thread that generates a random integer for every 1 second .
3. If the first thread value is even, design the second thread as the square of the number
--- Content provided by FirstRanker.com ---
and then print it.4.If the first thread value is odd, then third thread will print the value of cube of the
number.
5. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
30
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of multithreading has been done using three threads.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of multithreading to
generate odd numbers and its square using Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Multiplication Table Printing (3,5,8th
table)
(2) Printing Area of the cube, square and circle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
31Ex. No.: 10
GENERIC FUNCTION
Aim
--- Content provided by FirstRanker.com ---
To write a java program to find the maximum value from the given type of elements using a genericfunction.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the array with the elements
--- Content provided by FirstRanker.com ---
3. Sets the first value in the array as the current maximum4. Find the maximum value by comparing each elements of the array
5. Display the maximum value
6. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
32
--- Content provided by FirstRanker.com ---
Sample output:Result:
--- Content provided by FirstRanker.com ---
Thus the implementation of generic function is achieved for finding the maximum value from the giventype of elements.
Outcome:
Thus the course outcome (CO3) has been attained by applying the concept of generic function to
generate maximum value and minimum value. .
--- Content provided by FirstRanker.com ---
Applications:
(1) Finding even values
(2). Finding the sum of values
--- Content provided by FirstRanker.com ---
33
Ex. No.: 11
--- Content provided by FirstRanker.com ---
CALCULATORAim
To design a calculator using event-driven programming paradigm of Java for Decimal manipulations and
Scientific manipulations.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Using the swing components design the buttons of the calculator
3. Use key events and key listener to listen the events of the calculator.
4. Do the necessary manipulations.
5. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
34
Sample Output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of generic function is achieved for finding the maximum value from the given
type of elements.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO3) has been attained by applying the concept of event handling to
design calculator using Java.
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---
?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
III SEMESTER - R 2017
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
Name : ______________________________________Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious andenterprising professionals conforming to global standards through value based quality education and
training.
? To provide competent technical manpower capable of meeting requirements of the
--- Content provided by FirstRanker.com ---
Industry? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
on heart and soul
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineeringthrough quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of theelectronics industry
? To carry out research through continuous interaction with research institutes and industry, on
advances in communication systems
--- Content provided by FirstRanker.com ---
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
1. FUNDAMENTALS
--- Content provided by FirstRanker.com ---
To impart students with fundamental knowledge in Mathematics, Science and fundamentals ofengineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
complex software problems in industry and to develop practical solutions for them
--- Content provided by FirstRanker.com ---
3. BREADTHTo provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
4. PROFESSIONAL SKILLS
--- Content provided by FirstRanker.com ---
To bestow students with adequate training and provide opportunities to work as team that will buildup their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
To develop the ability of students to establish themselves as professionals in Computer Science
--- Content provided by FirstRanker.com ---
and Engineering and to create awareness about the need for lifelong learning and pursuing advanceddegrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
--- Content provided by FirstRanker.com ---
a) To apply the basic knowledge of Mathematics, Science and engineering fundamentals inComputer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
c) To design and develop innovative and creative software applications
--- Content provided by FirstRanker.com ---
d) To understand a complex real world problem and develop an efficient practical solutione) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
environmental, social, political, ethical, safe and sustainable
--- Content provided by FirstRanker.com ---
h) To communicate effectively and make others understand exactly what they are trying to convey inboth verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
j) To engage in lifelong learning and exhibit their technical skills
--- Content provided by FirstRanker.com ---
k) To develop and manage projects in multidisciplinary environment9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORYSYLLABUS
? To build software development skills using java programming for real-world applications.
--- Content provided by FirstRanker.com ---
? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
? To develop applications using generic programming and event handling.
--- Content provided by FirstRanker.com ---
LIST OF EXPERIMENTS:1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
following tariff.
--- Content provided by FirstRanker.com ---
If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INRand vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
COURSE OBJECTIVES
--- Content provided by FirstRanker.com ---
10
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no
--- Content provided by FirstRanker.com ---
as members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professorfrom employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
4. Design a Java interface for ADT Stack. Implement this interface using array. Provide
--- Content provided by FirstRanker.com ---
necessary exception handling in both the implementations.5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
b. Insert ? add at particular index
--- Content provided by FirstRanker.com ---
c. Searchd. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class
--- Content provided by FirstRanker.com ---
Shape. Each one of the classes contains only the method print Area () that prints thearea of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
whether the file exists, whether the file is readable, or writable, the type of file and the
--- Content provided by FirstRanker.com ---
length of the file in bytes.9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
will print the value of cube of the number.
--- Content provided by FirstRanker.com ---
10. Write a java program to find the maximum value from the given type of elements using ageneric function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
b) Scientific manipulations
--- Content provided by FirstRanker.com ---
12. Develop a mini project for any application using Java concepts.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
1 Electricity Bill Generation 13
--- Content provided by FirstRanker.com ---
2 Currency converter , Distance converter and Time converter 153 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
6 Abstract Class 23
--- Content provided by FirstRanker.com ---
7 Exception Handling 258 File Information 27
9 Multithreading 29
10 Generic Function 31
11 Calculator 33
--- Content provided by FirstRanker.com ---
12 Mini Project ? Vehicle Management System 36--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
ELECTRICITY BILL GENERATION
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs.1 per unit? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:
--- Content provided by FirstRanker.com ---
? First 100 units - Rs. 2 per unit? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount6. Stop the program
14
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application using
--- Content provided by FirstRanker.com ---
Java.Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
15
--- Content provided by FirstRanker.com ---
Ex. No.:2
Currency Converter, Distance Converter and Time Converter
Aim:
--- Content provided by FirstRanker.com ---
To develop a Java application to implement currency converter , distance converter and time converterusing packages.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
4. Print the converted value.
5. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created for currency conversion, distance conversion and timeconversion and it was successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
Applications :
--- Content provided by FirstRanker.com ---
(1) Kilogram to gram conversion(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
Ex. No.:3
--- Content provided by FirstRanker.com ---
PAYROLL PROCESSINGAim:
To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no as
--- Content provided by FirstRanker.com ---
members.3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.
--- Content provided by FirstRanker.com ---
5. Generate pay slips for the employees with their gross and net salary.6. Stop the program
--- Content provided by FirstRanker.com ---
18
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the Java application has been created with with employee class and pay slips are generated for
--- Content provided by FirstRanker.com ---
the employees with their gross and net salary.Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) EB Bill Generation(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
Ex. No.:4
ADT STACK
--- Content provided by FirstRanker.com ---
AimTo design a Java interface for ADT Stack using array.
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Define the interface.
3. Read the elements using array.
4. Initialize stackTop pointer as zero,
--- Content provided by FirstRanker.com ---
5. Define and use the method Push() to insert the elements into the stack with ?STACKOVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
7. Display the output.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
20
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the design and implementation of ADT Stack using array has successfully executed.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) ADT Queue(2) ADT circular queue
--- Content provided by FirstRanker.com ---
21
Ex. No.:5
--- Content provided by FirstRanker.com ---
STRING OPERATIONSAim
To write a program to perform string operations using ArrayList.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Add the String as an object to List.
--- Content provided by FirstRanker.com ---
3. Get the choice from the user and do according to the choicea. Append-add at end
b. Insert-add at particular index
c. Search
d. List all string starts with given letter.
--- Content provided by FirstRanker.com ---
3. Display the result4. Stop the program.
--- Content provided by FirstRanker.com ---
22
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the implementation of string operations using array list has been successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) Reverse of the String.(2) String Matching.
(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
23Ex. No.:6
ABSTRACT CLASS
Aim
--- Content provided by FirstRanker.com ---
To write a Java Program to create an abstract class named Shape and provide three classes namedRectangle, Triangle and Circle such that each one of the classes extends the class Shape.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the abstract class shape.
--- Content provided by FirstRanker.com ---
3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
7.Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the design and implementation of Abstract class has been successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
Java.
Applications:
--- Content provided by FirstRanker.com ---
(1) Volume of the Cube(2) Length of the Cube
(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25
Ex. No.:7
EXCEPTION HANDLING
--- Content provided by FirstRanker.com ---
AimTo write a Java program to implement user defined exception handling.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the exception for getting a number from the user.
--- Content provided by FirstRanker.com ---
3. If the number is positive print the number as such.4. If the number is negative throw the exception to the user as ?Number must be
positive?.
5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the user defined exception has been successfully implemented.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of Exception handlingfor an user defined exception using Java.
Applications:
(1) Throwing exception for Checking the @ symbol in Email Id
(2) Throwing exception for password mismatch.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
27
Ex. No.: 8
--- Content provided by FirstRanker.com ---
FILE INFORMATIONAim
To write a Java program that reads a file name from the user, displays information about whether the file
exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Read the filename from the user.3. Use getName() Method to display the filename.
4. Use getPath() Method to display the path of the file.
5. Use getParent() Method to display its parent?s information.
6. Use exists() Method to display whether the file exist or not
--- Content provided by FirstRanker.com ---
7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.8.Use canRead() and canWrite) methods to display whether the file is readable or writable.
9. Use lastModified() Method to display the modified information.
10. Use length() method to display the size of the file.
11. Use isHiddden() Method to display whether the file is hidden or not.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
28
--- Content provided by FirstRanker.com ---
Sample output:Result:
Thus the information of the file has been displayed successfully using various file methods.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained y file operations using Java..Applications:
(1) IRCTC chart display (RAC reservation)
(2) A2B menu display
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
29
--- Content provided by FirstRanker.com ---
Ex. No.: 9MULTITHREADING
Aim
To write a java program that implements a multi-threaded application.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Design the first thread that generates a random integer for every 1 second .
3. If the first thread value is even, design the second thread as the square of the number
and then print it.
4.If the first thread value is odd, then third thread will print the value of cube of the
--- Content provided by FirstRanker.com ---
number.5. Stop the program.
--- Content provided by FirstRanker.com ---
30
--- Content provided by FirstRanker.com ---
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of multithreading has been done using three threads.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of multithreading to
--- Content provided by FirstRanker.com ---
generate odd numbers and its square using Java.Applications :
(1) Multiplication Table Printing (3,5,8
th
--- Content provided by FirstRanker.com ---
table)(2) Printing Area of the cube, square and circle
--- Content provided by FirstRanker.com ---
31
--- Content provided by FirstRanker.com ---
Ex. No.: 10GENERIC FUNCTION
Aim
To write a java program to find the maximum value from the given type of elements using a generic
function.
--- Content provided by FirstRanker.com ---
Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Define the array with the elements
3. Sets the first value in the array as the current maximum
4. Find the maximum value by comparing each elements of the array
--- Content provided by FirstRanker.com ---
5. Display the maximum value6. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
32Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of generic function is achieved for finding the maximum value from the given
type of elements.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO3) has been attained by applying the concept of generic function to
generate maximum value and minimum value. .
Applications:
--- Content provided by FirstRanker.com ---
(1) Finding even values(2). Finding the sum of values
--- Content provided by FirstRanker.com ---
33Ex. No.: 11
CALCULATOR
Aim
--- Content provided by FirstRanker.com ---
To design a calculator using event-driven programming paradigm of Java for Decimal manipulations andScientific manipulations.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Using the swing components design the buttons of the calculator
--- Content provided by FirstRanker.com ---
3. Use key events and key listener to listen the events of the calculator.4. Do the necessary manipulations.
5. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
34Sample Output:
--- Content provided by FirstRanker.com ---
Result:Thus the implementation of generic function is achieved for finding the maximum value from the given
type of elements.
Outcome:
Thus the course outcome (CO3) has been attained by applying the concept of event handling to
--- Content provided by FirstRanker.com ---
design calculator using Java.35
--- Content provided by FirstRanker.com ---
Applications:
(1) Age calculator
(2) EB calculator
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
III SEMESTER - R 2017--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of theIndustry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
--- Content provided by FirstRanker.com ---
on heart and soul--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
--- Content provided by FirstRanker.com ---
1. FUNDAMENTALSTo impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
--- Content provided by FirstRanker.com ---
complex software problems in industry and to develop practical solutions for them3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
--- Content provided by FirstRanker.com ---
4. PROFESSIONAL SKILLSTo bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
--- Content provided by FirstRanker.com ---
To develop the ability of students to establish themselves as professionals in Computer Scienceand Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
PROGRAMME OUTCOMES (POs)
--- Content provided by FirstRanker.com ---
On completion of the B.E. (CSE) degree, the graduates will be ablea) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
--- Content provided by FirstRanker.com ---
c) To design and develop innovative and creative software applicationsd) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
--- Content provided by FirstRanker.com ---
environmental, social, political, ethical, safe and sustainableh) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
--- Content provided by FirstRanker.com ---
j) To engage in lifelong learning and exhibit their technical skillsk) To develop and manage projects in multidisciplinary environment
9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
--- Content provided by FirstRanker.com ---
following tariff.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 6 per unitIf the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 7 per unit2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_noas members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
4. Design a Java interface for ADT Stack. Implement this interface using array. Providenecessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
--- Content provided by FirstRanker.com ---
b. Insert ? add at particular indexc. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
--- Content provided by FirstRanker.com ---
Rectangle, Triangle and Circle such that each one of the classes extends the classShape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
--- Content provided by FirstRanker.com ---
whether the file exists, whether the file is readable, or writable, the type of file and thelength of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
--- Content provided by FirstRanker.com ---
will print the value of cube of the number.10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
--- Content provided by FirstRanker.com ---
b) Scientific manipulations12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
--- Content provided by FirstRanker.com ---
1 Electricity Bill Generation 132 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
--- Content provided by FirstRanker.com ---
6 Abstract Class 237 Exception Handling 25
8 File Information 27
9 Multithreading 29
10 Generic Function 31
--- Content provided by FirstRanker.com ---
11 Calculator 3312 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
--- Content provided by FirstRanker.com ---
ELECTRICITY BILL GENERATIONAim:
To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
--- Content provided by FirstRanker.com ---
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
--- Content provided by FirstRanker.com ---
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application usingJava.
Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
15Ex. No.:2
Currency Converter, Distance Converter and Time Converter
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application to implement currency converter , distance converter and time converter
using packages.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
4. Print the converted value.
--- Content provided by FirstRanker.com ---
5. Stop the program--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
--- Content provided by FirstRanker.com ---
Applications :(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
--- Content provided by FirstRanker.com ---
Ex. No.:3PAYROLL PROCESSING
Aim:
To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no asmembers.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
--- Content provided by FirstRanker.com ---
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
18
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created with with employee class and pay slips are generated forthe employees with their gross and net salary.
Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) EB Bill Generation
(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
Ex. No.:4
--- Content provided by FirstRanker.com ---
ADT STACKAim
To design a Java interface for ADT Stack using array.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the interface.
3. Read the elements using array.
--- Content provided by FirstRanker.com ---
4. Initialize stackTop pointer as zero,5. Define and use the method Push() to insert the elements into the stack with ?STACK
OVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
--- Content provided by FirstRanker.com ---
7. Display the output.--- Content provided by FirstRanker.com ---
20
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the design and implementation of ADT Stack using array has successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) ADT Queue
(2) ADT circular queue
--- Content provided by FirstRanker.com ---
21
--- Content provided by FirstRanker.com ---
Ex. No.:5STRING OPERATIONS
Aim
To write a program to perform string operations using ArrayList.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Add the String as an object to List.3. Get the choice from the user and do according to the choice
a. Append-add at end
b. Insert-add at particular index
c. Search
--- Content provided by FirstRanker.com ---
d. List all string starts with given letter.3. Display the result
4. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
22Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the implementation of string operations using array list has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) Reverse of the String.
(2) String Matching.
(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
23
Ex. No.:6
ABSTRACT CLASS
--- Content provided by FirstRanker.com ---
AimTo write a Java Program to create an abstract class named Shape and provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the abstract class shape.3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
--- Content provided by FirstRanker.com ---
7.Stop the Program.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the design and implementation of Abstract class has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
Java.
--- Content provided by FirstRanker.com ---
Applications:(1) Volume of the Cube
(2) Length of the Cube
(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25
Ex. No.:7
--- Content provided by FirstRanker.com ---
EXCEPTION HANDLINGAim
To write a Java program to implement user defined exception handling.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the exception for getting a number from the user.3. If the number is positive print the number as such.
4. If the number is negative throw the exception to the user as ?Number must be
positive?.
5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26
--- Content provided by FirstRanker.com ---
Sample output:
Result:
Thus the user defined exception has been successfully implemented.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of Exception handling
for an user defined exception using Java.
Applications:
(1) Throwing exception for Checking the @ symbol in Email Id
--- Content provided by FirstRanker.com ---
(2) Throwing exception for password mismatch.--- Content provided by FirstRanker.com ---
27
--- Content provided by FirstRanker.com ---
Ex. No.: 8FILE INFORMATION
Aim
To write a Java program that reads a file name from the user, displays information about whether the file
--- Content provided by FirstRanker.com ---
exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Read the filename from the user.
3. Use getName() Method to display the filename.
4. Use getPath() Method to display the path of the file.
5. Use getParent() Method to display its parent?s information.
--- Content provided by FirstRanker.com ---
6. Use exists() Method to display whether the file exist or not7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.
8.Use canRead() and canWrite) methods to display whether the file is readable or writable.
9. Use lastModified() Method to display the modified information.
10. Use length() method to display the size of the file.
--- Content provided by FirstRanker.com ---
11. Use isHiddden() Method to display whether the file is hidden or not.--- Content provided by FirstRanker.com ---
28
--- Content provided by FirstRanker.com ---
Sample output:
Result:
Thus the information of the file has been displayed successfully using various file methods.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO1) has been attained y file operations using Java..
Applications:
(1) IRCTC chart display (RAC reservation)
--- Content provided by FirstRanker.com ---
(2) A2B menu display--- Content provided by FirstRanker.com ---
29
--- Content provided by FirstRanker.com ---
Ex. No.: 9
MULTITHREADING
Aim
--- Content provided by FirstRanker.com ---
To write a java program that implements a multi-threaded application.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Design the first thread that generates a random integer for every 1 second .
3. If the first thread value is even, design the second thread as the square of the number
and then print it.
--- Content provided by FirstRanker.com ---
4.If the first thread value is odd, then third thread will print the value of cube of thenumber.
5. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
30Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of multithreading has been done using three threads.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of multithreading togenerate odd numbers and its square using Java.
Applications :
(1) Multiplication Table Printing (3,5,8
--- Content provided by FirstRanker.com ---
thtable)
(2) Printing Area of the cube, square and circle
--- Content provided by FirstRanker.com ---
31
--- Content provided by FirstRanker.com ---
Ex. No.: 10
GENERIC FUNCTION
Aim
To write a java program to find the maximum value from the given type of elements using a generic
--- Content provided by FirstRanker.com ---
function.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Define the array with the elements
3. Sets the first value in the array as the current maximum
--- Content provided by FirstRanker.com ---
4. Find the maximum value by comparing each elements of the array5. Display the maximum value
6. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
32
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of generic function is achieved for finding the maximum value from the given
--- Content provided by FirstRanker.com ---
type of elements.Outcome:
Thus the course outcome (CO3) has been attained by applying the concept of generic function to
generate maximum value and minimum value. .
--- Content provided by FirstRanker.com ---
Applications:(1) Finding even values
(2). Finding the sum of values
--- Content provided by FirstRanker.com ---
33
Ex. No.: 11
CALCULATOR
--- Content provided by FirstRanker.com ---
AimTo design a calculator using event-driven programming paradigm of Java for Decimal manipulations and
Scientific manipulations.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Using the swing components design the buttons of the calculator3. Use key events and key listener to listen the events of the calculator.
4. Do the necessary manipulations.
5. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
34
Sample Output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of generic function is achieved for finding the maximum value from the given
type of elements.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO3) has been attained by applying the concept of event handling todesign calculator using Java.
--- Content provided by FirstRanker.com ---
35Applications:
(1) Age calculator
--- Content provided by FirstRanker.com ---
(2) EB calculator--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
36
--- Content provided by FirstRanker.com ---
Ex. No.: 12VEHICLE MANAGEMENT SYSTEM
Aim
To design a vehicle management system using Java.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
? Notepad
? Internet Explorer 4.0
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Using the swing components design the necessary layout
3. Add the details using JDBC(Java Data Base Connectivity).
4. Get the details of vehicle number, make, Fuel type , Vehicle type ,Insurer ,Rupees per
--- Content provided by FirstRanker.com ---
kilometer , Cost and company from the user5. Store it in the database and do the necessary manipulations.
6. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
III SEMESTER - R 2017--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of theIndustry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
--- Content provided by FirstRanker.com ---
on heart and soul--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
--- Content provided by FirstRanker.com ---
1. FUNDAMENTALSTo impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
--- Content provided by FirstRanker.com ---
complex software problems in industry and to develop practical solutions for them3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
--- Content provided by FirstRanker.com ---
4. PROFESSIONAL SKILLSTo bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
--- Content provided by FirstRanker.com ---
To develop the ability of students to establish themselves as professionals in Computer Scienceand Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
PROGRAMME OUTCOMES (POs)
--- Content provided by FirstRanker.com ---
On completion of the B.E. (CSE) degree, the graduates will be ablea) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
--- Content provided by FirstRanker.com ---
c) To design and develop innovative and creative software applicationsd) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
--- Content provided by FirstRanker.com ---
environmental, social, political, ethical, safe and sustainableh) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
--- Content provided by FirstRanker.com ---
j) To engage in lifelong learning and exhibit their technical skillsk) To develop and manage projects in multidisciplinary environment
9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
--- Content provided by FirstRanker.com ---
following tariff.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 6 per unitIf the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 7 per unit2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_noas members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
4. Design a Java interface for ADT Stack. Implement this interface using array. Providenecessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
--- Content provided by FirstRanker.com ---
b. Insert ? add at particular indexc. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
--- Content provided by FirstRanker.com ---
Rectangle, Triangle and Circle such that each one of the classes extends the classShape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
--- Content provided by FirstRanker.com ---
whether the file exists, whether the file is readable, or writable, the type of file and thelength of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
--- Content provided by FirstRanker.com ---
will print the value of cube of the number.10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
--- Content provided by FirstRanker.com ---
b) Scientific manipulations12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
--- Content provided by FirstRanker.com ---
1 Electricity Bill Generation 132 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
--- Content provided by FirstRanker.com ---
6 Abstract Class 237 Exception Handling 25
8 File Information 27
9 Multithreading 29
10 Generic Function 31
--- Content provided by FirstRanker.com ---
11 Calculator 3312 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
--- Content provided by FirstRanker.com ---
ELECTRICITY BILL GENERATIONAim:
To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
--- Content provided by FirstRanker.com ---
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
--- Content provided by FirstRanker.com ---
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application usingJava.
Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
15Ex. No.:2
Currency Converter, Distance Converter and Time Converter
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application to implement currency converter , distance converter and time converter
using packages.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
4. Print the converted value.
--- Content provided by FirstRanker.com ---
5. Stop the program--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
--- Content provided by FirstRanker.com ---
Applications :(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
--- Content provided by FirstRanker.com ---
Ex. No.:3PAYROLL PROCESSING
Aim:
To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no asmembers.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
--- Content provided by FirstRanker.com ---
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
18
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created with with employee class and pay slips are generated forthe employees with their gross and net salary.
Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) EB Bill Generation
(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
Ex. No.:4
--- Content provided by FirstRanker.com ---
ADT STACKAim
To design a Java interface for ADT Stack using array.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the interface.
3. Read the elements using array.
--- Content provided by FirstRanker.com ---
4. Initialize stackTop pointer as zero,5. Define and use the method Push() to insert the elements into the stack with ?STACK
OVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
--- Content provided by FirstRanker.com ---
7. Display the output.--- Content provided by FirstRanker.com ---
20
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the design and implementation of ADT Stack using array has successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) ADT Queue
(2) ADT circular queue
--- Content provided by FirstRanker.com ---
21
--- Content provided by FirstRanker.com ---
Ex. No.:5STRING OPERATIONS
Aim
To write a program to perform string operations using ArrayList.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Add the String as an object to List.3. Get the choice from the user and do according to the choice
a. Append-add at end
b. Insert-add at particular index
c. Search
--- Content provided by FirstRanker.com ---
d. List all string starts with given letter.3. Display the result
4. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
22Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the implementation of string operations using array list has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) Reverse of the String.
(2) String Matching.
(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
23
Ex. No.:6
ABSTRACT CLASS
--- Content provided by FirstRanker.com ---
AimTo write a Java Program to create an abstract class named Shape and provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the abstract class shape.3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
--- Content provided by FirstRanker.com ---
7.Stop the Program.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the design and implementation of Abstract class has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
Java.
--- Content provided by FirstRanker.com ---
Applications:(1) Volume of the Cube
(2) Length of the Cube
(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25
Ex. No.:7
--- Content provided by FirstRanker.com ---
EXCEPTION HANDLINGAim
To write a Java program to implement user defined exception handling.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the exception for getting a number from the user.3. If the number is positive print the number as such.
4. If the number is negative throw the exception to the user as ?Number must be
positive?.
5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26
--- Content provided by FirstRanker.com ---
Sample output:
Result:
Thus the user defined exception has been successfully implemented.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of Exception handling
for an user defined exception using Java.
Applications:
(1) Throwing exception for Checking the @ symbol in Email Id
--- Content provided by FirstRanker.com ---
(2) Throwing exception for password mismatch.--- Content provided by FirstRanker.com ---
27
--- Content provided by FirstRanker.com ---
Ex. No.: 8FILE INFORMATION
Aim
To write a Java program that reads a file name from the user, displays information about whether the file
--- Content provided by FirstRanker.com ---
exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Read the filename from the user.
3. Use getName() Method to display the filename.
4. Use getPath() Method to display the path of the file.
5. Use getParent() Method to display its parent?s information.
--- Content provided by FirstRanker.com ---
6. Use exists() Method to display whether the file exist or not7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.
8.Use canRead() and canWrite) methods to display whether the file is readable or writable.
9. Use lastModified() Method to display the modified information.
10. Use length() method to display the size of the file.
--- Content provided by FirstRanker.com ---
11. Use isHiddden() Method to display whether the file is hidden or not.--- Content provided by FirstRanker.com ---
28
--- Content provided by FirstRanker.com ---
Sample output:
Result:
Thus the information of the file has been displayed successfully using various file methods.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO1) has been attained y file operations using Java..
Applications:
(1) IRCTC chart display (RAC reservation)
--- Content provided by FirstRanker.com ---
(2) A2B menu display--- Content provided by FirstRanker.com ---
29
--- Content provided by FirstRanker.com ---
Ex. No.: 9
MULTITHREADING
Aim
--- Content provided by FirstRanker.com ---
To write a java program that implements a multi-threaded application.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Design the first thread that generates a random integer for every 1 second .
3. If the first thread value is even, design the second thread as the square of the number
and then print it.
--- Content provided by FirstRanker.com ---
4.If the first thread value is odd, then third thread will print the value of cube of thenumber.
5. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
30Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of multithreading has been done using three threads.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of multithreading togenerate odd numbers and its square using Java.
Applications :
(1) Multiplication Table Printing (3,5,8
--- Content provided by FirstRanker.com ---
thtable)
(2) Printing Area of the cube, square and circle
--- Content provided by FirstRanker.com ---
31
--- Content provided by FirstRanker.com ---
Ex. No.: 10
GENERIC FUNCTION
Aim
To write a java program to find the maximum value from the given type of elements using a generic
--- Content provided by FirstRanker.com ---
function.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Define the array with the elements
3. Sets the first value in the array as the current maximum
--- Content provided by FirstRanker.com ---
4. Find the maximum value by comparing each elements of the array5. Display the maximum value
6. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
32
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of generic function is achieved for finding the maximum value from the given
--- Content provided by FirstRanker.com ---
type of elements.Outcome:
Thus the course outcome (CO3) has been attained by applying the concept of generic function to
generate maximum value and minimum value. .
--- Content provided by FirstRanker.com ---
Applications:(1) Finding even values
(2). Finding the sum of values
--- Content provided by FirstRanker.com ---
33
Ex. No.: 11
CALCULATOR
--- Content provided by FirstRanker.com ---
AimTo design a calculator using event-driven programming paradigm of Java for Decimal manipulations and
Scientific manipulations.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Using the swing components design the buttons of the calculator3. Use key events and key listener to listen the events of the calculator.
4. Do the necessary manipulations.
5. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
34
Sample Output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of generic function is achieved for finding the maximum value from the given
type of elements.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO3) has been attained by applying the concept of event handling todesign calculator using Java.
--- Content provided by FirstRanker.com ---
35Applications:
(1) Age calculator
--- Content provided by FirstRanker.com ---
(2) EB calculator--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
36
--- Content provided by FirstRanker.com ---
Ex. No.: 12VEHICLE MANAGEMENT SYSTEM
Aim
To design a vehicle management system using Java.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
? Notepad
? Internet Explorer 4.0
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Using the swing components design the necessary layout
3. Add the details using JDBC(Java Data Base Connectivity).
4. Get the details of vehicle number, make, Fuel type , Vehicle type ,Insurer ,Rupees per
--- Content provided by FirstRanker.com ---
kilometer , Cost and company from the user5. Store it in the database and do the necessary manipulations.
6. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
37
Sample output:
--- Content provided by FirstRanker.com ---
Admin PageVEHICLE MANAGEMENT ? ADMIN
Vehicle Details :
--- Content provided by FirstRanker.com ---
Result:Thus the design of vehicle management system using Java has been successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating a real world application using
Java.
--- Content provided by FirstRanker.com ---
FirstRanker.com - FirstRanker's Choice?
--- Content provided by FirstRanker.com ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
III SEMESTER - R 2017--- Content provided by FirstRanker.com ---
Name : ______________________________________
Reg. No. : ______________________________________
Section : ______________________________________
--- Content provided by FirstRanker.com ---
LABORATORY MANUAL
--- Content provided by FirstRanker.com ---
5
--- Content provided by FirstRanker.com ---
is committed to provide highly disciplined, conscientious and
enterprising professionals conforming to global standards through value based quality education and
training.
--- Content provided by FirstRanker.com ---
? To provide competent technical manpower capable of meeting requirements of theIndustry
? To contribute to the promotion of Academic Excellence in pursuit of Technical
Education at different levels
? To train the students to sell his brawn and brain to the highest bidder but to never put a price tag
--- Content provided by FirstRanker.com ---
on heart and soul--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
6
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
--- Content provided by FirstRanker.com ---
To strive for acquiring, applying and imparting knowledge in Computer Science and Engineering
through quality education and to provide enthusiastic professionals with commitment
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
--- Content provided by FirstRanker.com ---
? To carry out research through continuous interaction with research institutes and industry, onadvances in communication systems
? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
.
--- Content provided by FirstRanker.com ---
? To educate the students with the state-of-art technologies to meet the growing challenges of the
electronics industry
? To carry out research through continuous interaction with research institutes and industry, on
--- Content provided by FirstRanker.com ---
advances in communication systems? To provide the students with strong ground rules to facilitate them for systematic learning,
innovation and ethical practices
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
VISION
MISSION
--- Content provided by FirstRanker.com ---
7
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
--- Content provided by FirstRanker.com ---
1. FUNDAMENTALSTo impart students with fundamental knowledge in Mathematics, Science and fundamentals of
engineering that will mould them to be successful professionals
2. CORE COMPETENCE
To provide students with sound knowledge in engineering and experimental skills to identify
--- Content provided by FirstRanker.com ---
complex software problems in industry and to develop practical solutions for them3. BREADTH
To provide relevant training and experience to bridge the gap between theory and practice which
enables them to find solutions for real time problems in industry and organization, and to design products
requiring interdisciplinary skills
--- Content provided by FirstRanker.com ---
4. PROFESSIONAL SKILLSTo bestow students with adequate training and provide opportunities to work as team that will build
up their communication skills, individual leadership and supportive qualities, and to enable them to adapt
and work in ever changing technologies
5. LIFELONG LEARNING
--- Content provided by FirstRanker.com ---
To develop the ability of students to establish themselves as professionals in Computer Scienceand Engineering and to create awareness about the need for lifelong learning and pursuing advanced
degrees
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
8
PROGRAMME OUTCOMES (POs)
--- Content provided by FirstRanker.com ---
On completion of the B.E. (CSE) degree, the graduates will be ablea) To apply the basic knowledge of Mathematics, Science and engineering fundamentals in
Computer Science and Engineering field
b) To design and conduct experiments as well as to analyze and interpret and apply the same in the
career
--- Content provided by FirstRanker.com ---
c) To design and develop innovative and creative software applicationsd) To understand a complex real world problem and develop an efficient practical solution
e) To create, select and apply appropriate techniques, resources, modern engineering and IT tools
f) To understand their roles as a professionals and give the best to the society
g) To develop a system that will meet expected needs within realistic constraints such as economical,
--- Content provided by FirstRanker.com ---
environmental, social, political, ethical, safe and sustainableh) To communicate effectively and make others understand exactly what they are trying to convey in
both verbal and written forms
i) To work in a team as team member or a leader and make unique contributions and work with
coordination
--- Content provided by FirstRanker.com ---
j) To engage in lifelong learning and exhibit their technical skillsk) To develop and manage projects in multidisciplinary environment
9
--- Content provided by FirstRanker.com ---
CS8383 ?OBJECT ORIENTED LABORATORY
SYLLABUS
--- Content provided by FirstRanker.com ---
? To build software development skills using java programming for real-world applications.? To understand and apply the concepts of classes, packages, interfaces, arraylist, exception handling
and file processing.
--- Content provided by FirstRanker.com ---
? To develop applications using generic programming and event handling.LIST OF EXPERIMENTS:
1. Develop a Java application to generate Electricity bill. Create a class with the following members:
Consumer no., consumer name, previous month reading, current month reading, type of EB connection
(i.e domestic or commercial). Compute the bill amount using the
--- Content provided by FirstRanker.com ---
following tariff.If the type of the EB connection is domestic, calculate the amount to be paid as follows:
? First 100 units - Rs. 1 per unit
? 101-200 units - Rs. 2.50 per unit
? 201 -500 units - Rs. 4 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 6 per unitIf the type of the EB connection is commercial, calculate the amount to be paid as follows:
? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
--- Content provided by FirstRanker.com ---
? > 501 units - Rs. 7 per unit2. Develop a javaL application to implement currency converter (Dollar to INR, EURO to INR, Yen to INR
and vice versa), distance converter (meter to KM, miles to KM and vice versa) , time converter
(hours to minutes, seconds and vice versa) using packages.
--- Content provided by FirstRanker.com ---
COURSE OBJECTIVES10
--- Content provided by FirstRanker.com ---
3. Develop a java application with Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_noas members. Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class. Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as
DA, 10 % of BP as HRA, 12% of BP as PF, 0.1% of BP
for staff club fund. Generate pay slips for the employees with their gross and net salary.
--- Content provided by FirstRanker.com ---
4. Design a Java interface for ADT Stack. Implement this interface using array. Providenecessary exception handling in both the implementations.
5. Write a program to perform string operations using ArrayList. Write functions
for the following
a. Append - add at end
--- Content provided by FirstRanker.com ---
b. Insert ? add at particular indexc. Search
d. List all string starts with given letter
6. Write a Java Program to create an abstract class named Shape that contains two
integers and an empty method named print Area(). Provide three classes named
--- Content provided by FirstRanker.com ---
Rectangle, Triangle and Circle such that each one of the classes extends the classShape. Each one of the classes contains only the method print Area () that prints the
area of the given shape.
7. Write a Java program to implement user defined exception handling.
8. Write a Java program that reads a file name from the user, displays information about
--- Content provided by FirstRanker.com ---
whether the file exists, whether the file is readable, or writable, the type of file and thelength of the file in bytes.
9. Write a java program that implements a multi-threaded application that has three threads.
First thread generates a random integer every 1 second and if the value is even, second
thread computes the square of the number and prints. If the value is odd, the third thread
--- Content provided by FirstRanker.com ---
will print the value of cube of the number.10. Write a java program to find the maximum value from the given type of elements using a
generic function.
11. Design a calculator using event-driven programming paradigm of Java with the
following options.
--- Content provided by FirstRanker.com ---
11
a) Decimal manipulations
--- Content provided by FirstRanker.com ---
b) Scientific manipulations12. Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
12
--- Content provided by FirstRanker.com ---
CS8383 ? OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
Sl. No. Name of the Experiment Page No.
--- Content provided by FirstRanker.com ---
1 Electricity Bill Generation 132 Currency converter , Distance converter and Time converter 15
3 Payroll Processing 18
4 ADT Stack 19
5 String Operations 21
--- Content provided by FirstRanker.com ---
6 Abstract Class 237 Exception Handling 25
8 File Information 27
9 Multithreading 29
10 Generic Function 31
--- Content provided by FirstRanker.com ---
11 Calculator 3312 Mini Project ? Vehicle Management System 36
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
13
Ex. No.:1
--- Content provided by FirstRanker.com ---
ELECTRICITY BILL GENERATIONAim:
To develop a Java application to generate Electricity bill.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create consumer class with the following members: Consumer no., consumer name,
previous month reading, current month reading, type of EB connection (i.e domestic or
commercial).
--- Content provided by FirstRanker.com ---
3.If the type of the EB connection is domestic, calculate the amount to be paid as follows:? First 100 units - Rs.1 per unit
? 101-200 units - Rs.2.50 per unit
? 201 -500 units - Rs. 4 per unit
? > 501 units - Rs.6 per unit
--- Content provided by FirstRanker.com ---
4. If the type of the EB connection is commercial, calculate the amount to be paid as follows:? First 100 units - Rs. 2 per unit
? 101-200 units - Rs. 4.50 per unit
? 201 -500 units - Rs. 6 per unit
? > 501 units - Rs. 7 per unit
--- Content provided by FirstRanker.com ---
5. Print the amount
6. Stop the program
--- Content provided by FirstRanker.com ---
14Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO1) has been attained by generating an Electricity Bill application usingJava.
Applications :
(1) Payroll Processing
(2) PF Calculation
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
15Ex. No.:2
Currency Converter, Distance Converter and Time Converter
--- Content provided by FirstRanker.com ---
Aim:To develop a Java application to implement currency converter , distance converter and time converter
using packages.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Create three packages for currency converter , distance converter and time converter.
3. Create corresponding code for conversion
4. Print the converted value.
--- Content provided by FirstRanker.com ---
5. Stop the program--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
16Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the Java application has been created for currency conversion, distance conversion and time
conversion and it was successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of packages using Java.
--- Content provided by FirstRanker.com ---
Applications :(1) Kilogram to gram conversion
(2) Celsius to Fahrenheit conversion
--- Content provided by FirstRanker.com ---
17
--- Content provided by FirstRanker.com ---
Ex. No.:3PAYROLL PROCESSING
Aim:
To develop a Java application with employee class and generate pay slips for the employees with their
gross and net salary.
--- Content provided by FirstRanker.com ---
Hardware Requirements:? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Create Employee class with Emp_name, Emp_id, Address, Mail_id, Mobile_no asmembers.
3.Inherit the classes, Programmer, Assistant Professor, Associate Professor and Professor
from employee class.
4.Add Basic Pay (BP) as the member of all the inherited classes with 97% of BP as DA, 10
--- Content provided by FirstRanker.com ---
% of BP as HRA, 12% of BP as PF, 0.1% of BP for staff club fund.5. Generate pay slips for the employees with their gross and net salary.
6. Stop the program
--- Content provided by FirstRanker.com ---
18
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created with with employee class and pay slips are generated forthe employees with their gross and net salary.
Outcome:
Thus the course outcome (CO1) has been attained by applying the concept of inheritance to
generate Payroll Processing application using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) EB Bill Generation
(2) Income Tax Calculation
--- Content provided by FirstRanker.com ---
19
Ex. No.:4
--- Content provided by FirstRanker.com ---
ADT STACKAim
To design a Java interface for ADT Stack using array.
Hardware Requirements:
? Pentium IV with 2 GB RAM
--- Content provided by FirstRanker.com ---
? 160 GB HARD Disk? Monitor 1024 x 768 colour
Software Requirements:
? Ubentu 14.04 operating system
--- Content provided by FirstRanker.com ---
? JDK 1.8Procedure:
1. Start the program
2. Define the interface.
3. Read the elements using array.
--- Content provided by FirstRanker.com ---
4. Initialize stackTop pointer as zero,5. Define and use the method Push() to insert the elements into the stack with ?STACK
OVERFLOW? condition.
6. Define and use the method pop() to remove an element from an array with ?STACK
UNDERFLOW? condition
--- Content provided by FirstRanker.com ---
7. Display the output.--- Content provided by FirstRanker.com ---
20
--- Content provided by FirstRanker.com ---
Sample output:
Result:
--- Content provided by FirstRanker.com ---
Thus the design and implementation of ADT Stack using array has successfully executed.Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of array to generate
ADT Stack using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) ADT Queue
(2) ADT circular queue
--- Content provided by FirstRanker.com ---
21
--- Content provided by FirstRanker.com ---
Ex. No.:5STRING OPERATIONS
Aim
To write a program to perform string operations using ArrayList.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Add the String as an object to List.3. Get the choice from the user and do according to the choice
a. Append-add at end
b. Insert-add at particular index
c. Search
--- Content provided by FirstRanker.com ---
d. List all string starts with given letter.3. Display the result
4. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
22Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the implementation of string operations using array list has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of arraylist for string
manipulations using Java.
--- Content provided by FirstRanker.com ---
Applications:(1) Reverse of the String.
(2) String Matching.
(3) Counting the number of vowels and consonants in a line.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
23
Ex. No.:6
ABSTRACT CLASS
--- Content provided by FirstRanker.com ---
AimTo write a Java Program to create an abstract class named Shape and provide three classes named
Rectangle, Triangle and Circle such that each one of the classes extends the class Shape.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the abstract class shape.3. Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
4. Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
5. Define the class Circle with PrintArea() method that extends(makes use of) Shape.
6. Print the area of the Rectangle,Triangle and Circle .
--- Content provided by FirstRanker.com ---
7.Stop the Program.--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
24
Sample output:
--- Content provided by FirstRanker.com ---
Result:Thus the design and implementation of Abstract class has been successfully executed.
Outcome:
Thus the course outcome (CO2) has been attained by applying the concept of abstract class using
Java.
--- Content provided by FirstRanker.com ---
Applications:(1) Volume of the Cube
(2) Length of the Cube
(3) Area of Triangle
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
25
Ex. No.:7
--- Content provided by FirstRanker.com ---
EXCEPTION HANDLINGAim
To write a Java program to implement user defined exception handling.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Define the exception for getting a number from the user.3. If the number is positive print the number as such.
4. If the number is negative throw the exception to the user as ?Number must be
positive?.
5. Stop the Program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
26
--- Content provided by FirstRanker.com ---
Sample output:
Result:
Thus the user defined exception has been successfully implemented.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO2) has been attained by applying the concept of Exception handling
for an user defined exception using Java.
Applications:
(1) Throwing exception for Checking the @ symbol in Email Id
--- Content provided by FirstRanker.com ---
(2) Throwing exception for password mismatch.--- Content provided by FirstRanker.com ---
27
--- Content provided by FirstRanker.com ---
Ex. No.: 8FILE INFORMATION
Aim
To write a Java program that reads a file name from the user, displays information about whether the file
--- Content provided by FirstRanker.com ---
exists, whether the file is readable, or writable, the type of file and the length of the file in bytes.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
Procedure:
--- Content provided by FirstRanker.com ---
1. Start the program2. Read the filename from the user.
3. Use getName() Method to display the filename.
4. Use getPath() Method to display the path of the file.
5. Use getParent() Method to display its parent?s information.
--- Content provided by FirstRanker.com ---
6. Use exists() Method to display whether the file exist or not7. Use isFile() and isDirectory() Methods to display whether the file is file or directory.
8.Use canRead() and canWrite) methods to display whether the file is readable or writable.
9. Use lastModified() Method to display the modified information.
10. Use length() method to display the size of the file.
--- Content provided by FirstRanker.com ---
11. Use isHiddden() Method to display whether the file is hidden or not.--- Content provided by FirstRanker.com ---
28
--- Content provided by FirstRanker.com ---
Sample output:
Result:
Thus the information of the file has been displayed successfully using various file methods.
--- Content provided by FirstRanker.com ---
Outcome:Thus the course outcome (CO1) has been attained y file operations using Java..
Applications:
(1) IRCTC chart display (RAC reservation)
--- Content provided by FirstRanker.com ---
(2) A2B menu display--- Content provided by FirstRanker.com ---
29
--- Content provided by FirstRanker.com ---
Ex. No.: 9
MULTITHREADING
Aim
--- Content provided by FirstRanker.com ---
To write a java program that implements a multi-threaded application.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
? Monitor 1024 x 768 colour
--- Content provided by FirstRanker.com ---
Software Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Design the first thread that generates a random integer for every 1 second .
3. If the first thread value is even, design the second thread as the square of the number
and then print it.
--- Content provided by FirstRanker.com ---
4.If the first thread value is odd, then third thread will print the value of cube of thenumber.
5. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
30Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of multithreading has been done using three threads.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO2) has been attained by applying the concept of multithreading togenerate odd numbers and its square using Java.
Applications :
(1) Multiplication Table Printing (3,5,8
--- Content provided by FirstRanker.com ---
thtable)
(2) Printing Area of the cube, square and circle
--- Content provided by FirstRanker.com ---
31
--- Content provided by FirstRanker.com ---
Ex. No.: 10
GENERIC FUNCTION
Aim
To write a java program to find the maximum value from the given type of elements using a generic
--- Content provided by FirstRanker.com ---
function.Hardware Requirements:
? Pentium IV with 2 GB RAM
? 160 GB HARD Disk
--- Content provided by FirstRanker.com ---
? Monitor 1024 x 768 colourSoftware Requirements:
? Ubentu 14.04 operating system
? JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
1. Start the program
2. Define the array with the elements
3. Sets the first value in the array as the current maximum
--- Content provided by FirstRanker.com ---
4. Find the maximum value by comparing each elements of the array5. Display the maximum value
6. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
32
Sample output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of generic function is achieved for finding the maximum value from the given
--- Content provided by FirstRanker.com ---
type of elements.Outcome:
Thus the course outcome (CO3) has been attained by applying the concept of generic function to
generate maximum value and minimum value. .
--- Content provided by FirstRanker.com ---
Applications:(1) Finding even values
(2). Finding the sum of values
--- Content provided by FirstRanker.com ---
33
Ex. No.: 11
CALCULATOR
--- Content provided by FirstRanker.com ---
AimTo design a calculator using event-driven programming paradigm of Java for Decimal manipulations and
Scientific manipulations.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
Procedure:
1. Start the program
--- Content provided by FirstRanker.com ---
2. Using the swing components design the buttons of the calculator3. Use key events and key listener to listen the events of the calculator.
4. Do the necessary manipulations.
5. Stop the program.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
34
Sample Output:
--- Content provided by FirstRanker.com ---
Result:
Thus the implementation of generic function is achieved for finding the maximum value from the given
type of elements.
Outcome:
--- Content provided by FirstRanker.com ---
Thus the course outcome (CO3) has been attained by applying the concept of event handling todesign calculator using Java.
--- Content provided by FirstRanker.com ---
35Applications:
(1) Age calculator
--- Content provided by FirstRanker.com ---
(2) EB calculator--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
36
--- Content provided by FirstRanker.com ---
Ex. No.: 12VEHICLE MANAGEMENT SYSTEM
Aim
To design a vehicle management system using Java.
Hardware Requirements:
--- Content provided by FirstRanker.com ---
? Pentium IV with 2 GB RAM? 160 GB HARD Disk
? Monitor 1024 x 768 colour
Software Requirements:
--- Content provided by FirstRanker.com ---
? Ubentu 14.04 operating system? JDK 1.8
? Notepad
? Internet Explorer 4.0
--- Content provided by FirstRanker.com ---
Procedure:1. Start the program
2. Using the swing components design the necessary layout
3. Add the details using JDBC(Java Data Base Connectivity).
4. Get the details of vehicle number, make, Fuel type , Vehicle type ,Insurer ,Rupees per
--- Content provided by FirstRanker.com ---
kilometer , Cost and company from the user5. Store it in the database and do the necessary manipulations.
6. Stop the program
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
37
Sample output:
--- Content provided by FirstRanker.com ---
Admin PageVEHICLE MANAGEMENT ? ADMIN
Vehicle Details :
--- Content provided by FirstRanker.com ---
Result:Thus the design of vehicle management system using Java has been successfully executed.
Outcome:
Thus the course outcome (CO1) has been attained by generating a real world application using
Java.
--- Content provided by FirstRanker.com ---
38
MINIPROJECTS
--- Content provided by FirstRanker.com ---
1. Airline Reservation System
2. Mark sheet Preparation system
3. NAAC online application creation
--- Content provided by FirstRanker.com ---
4. Library Management System5. Converting RGB image to Gray Image
6. Health Care System
7. App development
8. Income Tax System
--- Content provided by FirstRanker.com ---
9. Vehicle Tracking System10. Ebanking System
FirstRanker.com - FirstRanker's Choice
--- Content provided by FirstRanker.com ---