DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
CS8383 - OBJECT ORIENTED PROGRAMMING LABORATORY
--- Content provided by FirstRanker.com ---
III SEMESTER - R 2017
LABORATORY MANUAL
Name :
Reg. No. :
Section :
--- Content provided by FirstRanker.com ---
VISION
is committed to provide highly disciplined, conscientious and enterprising professionals conforming to global standards through value based quality education and training.
MISSION
- 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
- 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 ---
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
VISION
--- 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
- 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
MISSION
--- 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 advances in communication systems
- To provide the students with strong ground rules to facilitate them for systematic learning, innovation and ethical practices
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
--- Content provided by FirstRanker.com ---
- FUNDAMENTALS
To impart students with fundamental knowledge in Mathematics, Science and fundamentals of engineering that will mould them to be successful professionals
- 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
- 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 ---
- 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
- 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 ---
PROGRAMME OUTCOMES (POs)
On completion of the B.E. (CSE) degree, the graduates will be able
- To apply the basic knowledge of Mathematics, Science and engineering fundamentals in Computer Science and Engineering field
- To design and conduct experiments as well as to analyze and interpret and apply the same in the career
- To design and develop innovative and creative software applications
- To understand a complex real world problem and develop an efficient practical solution
- To create, select and apply appropriate techniques, resources, modern engineering and IT tools
- To understand their roles as a professionals and give the best to the society
- To develop a system that will meet expected needs within realistic constraints such as economical, environmental, social, political, ethical, safe and sustainable
- To communicate effectively and make others understand exactly what they are trying to convey in both verbal and written forms
- To work in a team as team member or a leader and make unique contributions and work with coordination
- To engage in lifelong learning and exhibit their technical skills
- To develop and manage projects in multidisciplinary environment
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
CS8383-OBJECT ORIENTED LABORATORY
SYLLABUS
COURSE OBJECTIVES
- 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.
- To develop applications using generic programming and event handling.
--- Content provided by FirstRanker.com ---
LIST OF EXPERIMENTS:
- 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:
- 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 ---
- 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 ---
- Develop a java 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.
- 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 for staff club fund. Generate pay slips for the employees with their gross and net salary.
- Design a Java interface for ADT Stack. Implement this interface using array. Provide necessary exception handling in both the implementations.
- Write a program to perform string operations using ArrayList. Write functions for the following
- Append - add at end
- Insert - add at particular index
- Search
- List all string starts with given letter
- 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 the method print Area () that prints the area of the given shape.
- Write a Java program to implement user defined exception handling.
- 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.
- 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.
- Write a java program to find the maximum value from the given type of elements using a generic function.
- Design a calculator using event-driven programming paradigm of Java with the following options.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
- Decimal manipulations
- Scientific manipulations
- Develop a mini project for any application using Java concepts.
--- Content provided by FirstRanker.com ---
CS8383-OBJECT ORIENTED PROGRAMMING LABORATORY
INDEX
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 |
5 | String Operations | 21 |
6 | Abstract Class | 23 |
7 | Exception Handling | 25 |
8 | File Information | 27 |
9 | Multithreading | 29 |
10 | Generic Function | 31 |
11 | Calculator | 33 |
12 | Mini Project – Vehicle Management System | 36 |
Ex. No.: 1
--- Content provided by FirstRanker.com ---
ELECTRICITY BILL GENERATION
Aim:
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
--- Content provided by FirstRanker.com ---
Procedure:
- Start the program
- 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).
- 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 ---
- Print the amount
- Stop the program
--- Content provided by FirstRanker.com ---
Result:
Thus the Electricity Bill Java application was successfully executed.
Outcome:
Thus the course outcome has been attained by generating an Electricity Bill application using Java.
--- Content provided by FirstRanker.com ---
Applications:
- Payroll Processing
- PF Calculation
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.
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:
- Start the program
- Create three packages for currency converter, distance converter and time converter.
- Create corresponding code for conversion
- Print the converted value.
- Stop the program
--- 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:
- Kilogram to gram conversion
- Celsius to Fahrenheit conversion
--- 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 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:
- Ubentu 14.04 operating system
- JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
- Start the program
- Create 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 for staff club fund.
- Generate pay slips for the employees with their gross and net salary.
- Stop the program
--- Content provided by FirstRanker.com ---
Result:
--- Content provided by FirstRanker.com ---
Thus the Java application has been created 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 generate Payroll Processing application using Java.
Applications:
- EB Bill Generation
- Income Tax Calculation
--- Content provided by FirstRanker.com ---
Ex. 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:
- Start the program
- Define the interface.
- Read the elements using array.
- Initialize stackTop pointer as zero,
- Define and use the method Push() to insert the elements into the stack with 'STACK OVERFLOW' condition.
- Define and use the method pop() to remove an element from an array with ‘STACK UNDERFLOW’ condition
- Display the output.
--- Content provided by FirstRanker.com ---
--- 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 generate ADT Stack using Java.
Applications:
- ADT Queue
- ADT circular queue
--- Content provided by FirstRanker.com ---
Ex. No.:5
STRING 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:
- Ubentu 14.04 operating system
- JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
- Start the program
- Add the String as an object to List.
- Get the choice from the user and do according to the choice
- Append-add at end
- Insert-add at particular index
- Search
- List all string starts with given letter.
--- Content provided by FirstRanker.com ---
- Display the result
- Stop the program.
--- 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 string manipulations using Java.
Applications:
- Reverse of the String.
- String Matching.
- Counting the number of vowels and consonants in a line.
--- 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 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
Software Requirements:
--- Content provided by FirstRanker.com ---
- Ubentu 14.04 operating system
- JDK 1.8
Procedure:
- Start the program
- Define the abstract class shape.
- Define the class Rectangle with PrintArea() method that extends(makes use of) Shape.
- Define the class Triangle with PrintArea() method that extends(makes use of) Shape.
- Define the class Circle with PrintArea() method that extends(makes use of) Shape.
- Print the area of the Rectangle,Triangle and Circle .
- Stop the Program.
--- Content provided by FirstRanker.com ---
--- 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:
- Volume of the Cube
- Length of the Cube
- Area of Triangle
--- Content provided by FirstRanker.com ---
Ex. No.:7
EXCEPTION HANDLING
Aim
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:
- Ubentu 14.04 operating system
- JDK 1.8
--- Content provided by FirstRanker.com ---
Procedure:
- Start the program
- Define the exception for getting a number from the user.
- If the number is positive print the number as such.
- If the number is negative throw the exception to the user as 'Number must be positive'.
- Stop the Program.
--- Content provided by FirstRanker.com ---
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:
- Throwing exception for Checking the @ symbol in Email Id
- Throwing exception for password mismatch.
--- Content provided by FirstRanker.com ---
Ex. No.: 8
FILE INFORMATION
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.
--- 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:
- Start the program
- Read the filename from the user.
- Use getName() Method to display the filename
- Use getPath() Method to display the path of the file.
- Use getParent() Method to display its parent's information.
- Use exists() Method to display whether the file exist or not
- Use isFile() and isDirectory() Methods to display whether the file is file or directory.
- Use canRead() and canWrite) methods to display whether the file is readable or writable.
- Use lastModified() Method to display the modified information.
- Use length() method to display the size of the file.
- Use isHidden() Method to display whether the file is hidden or not.
--- Content provided by FirstRanker.com ---
--- Content provided by FirstRanker.com ---
--- 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 by file operations using Java.
Applications:
--- Content provided by FirstRanker.com ---
- IRCTC chart display (RAC reservation)
- A2B menu display
Ex. 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
- 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 ---
- Start the program
- Design the first thread that generates a random integer for every 1 second.
- If the first thread value is even, design the second thread as the square of the number and then print it.
- If the first thread value is odd, then third thread will print the value of cube of the number.
- Stop the program.
--- 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:
- Multiplication Table Printing (3,5,8th table)
- Printing Area of the cube, square and circle
Ex. No.: 10
--- Content provided by FirstRanker.com ---
GENERIC FUNCTION
Aim
To write a java program to find the maximum value from the given type of elements using a generic function.
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:
- Start the program
- Define the array with the elements
- Sets the first value in the array as the current maximum
- Find the maximum value by comparing each elements of the array
- Display the maximum value
- Stop the program.
--- 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:
- Finding even values
- Finding the sum of values
--- Content provided by FirstRanker.com ---
Ex. No.: 11
CALCULATOR
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
Software Requirements:
--- Content provided by FirstRanker.com ---
- Ubentu 14.04 operating system
- JDK 1.8
Procedure:
- Start the program
- Using the swing components design the buttons of the calculator
- Use key events and key listener to listen the events of the calculator.
- Do the necessary manipulations.
- Stop the program.
--- Content provided by FirstRanker.com ---
Result:
--- Content provided by FirstRanker.com ---
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 design calculator using Java.
Applications:
--- Content provided by FirstRanker.com ---
- Age calculator
- EB calculator
Ex. No.: 12
VEHICLE MANAGEMENT SYSTEM
--- Content provided by FirstRanker.com ---
Aim
To design a vehicle management system using Java.
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
- Notepad
- Internet Explorer 4.0
--- Content provided by FirstRanker.com ---
Procedure:
This download link is referred from the post: Anna University B.Tech Lab Manual
--- Content provided by FirstRanker.com ---