2 - B.Tech (CSE) - ES203-Object Oriented Programing Using C++
2 - B.Tech (CSE) - ES203-Object Oriented Programing Using C++
2 - B.Tech (CSE) - ES203-Object Oriented Programing Using C++
AMITY UNIVERSITY
JHARKHAND
LAB MANUAL
1. Students should be regular and come prepared for the lab practice.
2. In case a student misses a class, it is his/her responsibility to complete that missed
experiment(s).
3. Students should bring the observation book, lab journal and lab manual.
4. Prescribed textbook and class notes can be kept ready for reference if required.
5. They should implement the given experiment individually.
6. Once the experiment(s) get executed, they should show the program and results to the instructors
and copy the same in their observation book.
7. Questions for lab tests and exam need not necessarily be limited to the questions in the manual
but could involve some variations and / or combinations of the questions.
8. All the students must maintain silence inside the lab.
9. All the students must carry their id card before entering the lab, and college uniform is strictly
mandatory, otherwise students will not be permitted to sit inside the lab.
10. No food or beverage items are allowed inside the lab.
11. Keep your bags outside the lab.
12. Do not use cell phone inside the lab. (If anybody found using cell phone inside the lab, his/her
mobile phone will be seized by the responsible authority.)
13. Shut down the system and arrange your chair before leaving the lab.
14. While using lab sign in the register with your name, enrollment number and branch to mark your
attendance.
15. Do not plug any device without permission.
16. Do not use internet without permission.
Note: Above mentioned instructions can be modified based on the context of the lab.
Credit Unit
L P/S
T SW/FW Total Credit Units
(Lecture) (Practical/Studio)
3 - 2 - 4
Components Lab
Performance Viva Attendance
(Drop down) Record
70
Weightage (%) 10 5 10 5
Course Objectives:
After finishing this course student will be able to:
1) Get introduction of object-oriented programming.
2) Explore and implement the various features of oop such as inheritance, polymorphism,
exceptional handling etc. Using programming language c++.
3) To easily identify the basic difference between the programming approaches like procedural
and object oriented
List of Experiments
Week 1: Simple C++ Programs to Implement Various Control Structures. If statement, Switch case
statement and do while loop, For loop, While loop
1. Define a structure to represent a student. Keep track of you, ID, Name and CGPA. Write function
namely input, display and edit to input details to a student variable, to display it and to edit it
respectively. Write a main function with define a structure pointer to access variables. Invoke the
functions in the main and observe the result.
2. Define a structure called rectangle which keep track of the length and breadth of a rectangle. Write
functions namely input, display dimensions, display area and added to input the dimension of a
rectangle, to display the dimensions, to calculate and display the area of a rectangle respectively. Write a
main function which define a variable of type rectangle. Invoke date functions in the main and observe
the result.
3. Write a user defined function which concatenate one string to another and display the concatenated
string. Pass the two string as parameter to the function. The return value of the function should be the
concatenated string and show the usage of this function in the main.
1. Design a base class called Student with the following 2 fields: i) Name ii) ID derive 2 classes call sports
and exam from Student base class. Class Sports has a field call s_ grade and class Exam has a field call
e_grade which are integer fields.
Derive class called Result which inherit the Sports and Exam. This Class has a char. array or string field
to represent the final result. Also, it has a member function called display which can be used to display the
final result.
Illustrate the uses of these classes in the main.
2. Create a base class called Shape. Used this class to store two double type value which could be used to
compute the area of figure. Derive 2 specified class called Triangle and Rectangle from the base class
Shape. Add to the base class; a member function called get_data to initialise base class data member and
another member function display_area to compute and display area of figure. Make display_area a
virtual function and redefined this function in the derived classes to suit their requirement. Using these
three classes design a program which will accept dimensions of a triangle or rectangle interactively and
display the area.
Week 8: Programs to Overload Unary & Binary Operators as Member Function & Non-Member
Function.
a. Unary operator as member function
b. Binary operator as non-member function
1. Define a class IntArr which hosts an array of integers. Provide the following member function:
a) A default constructor.
b) A parameterized constructor which initializes the array of the object.
c) A copy constructor
*******
Text Books:
Web References: