Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Merged Removed

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

LAB FILE OF

OBJECT ORIENTED PROGRAMMING


CIC-257

Faculty name: Mrs. Seema Kalonia Student name : Sumit Singh


Roll No.: 05114803121
Group: I1
Semester: 3r

Maharaja Agrasen Institute of Technology, PSP


Area, Sector - 22, Rohini, New Delhi - 110085
OBJECT ORIENTED PROGRAMMING LAB

PRACTICAL RECORD

PAPER CODE : CIC-257

Name of the student : Sumit Singh

University Roll No : 00214803121

Branch : Information Technology (IT)

Section/ Group : I1

PRACTICAL DETAILS

S no. Experiment Name Date Signature

1. Write a program to take name, address as a character array age as


integer, salary as float and contains inline function to set the values
and display it in class

2. Using the concept of function overloading write function for


calculating area of triangle, circle rectangle.

3. Write a program to find number m to power n. The function power


takes a double variable for m and int value for n. Use default values
for n to make the function to calculate squares when this argument is
omitted.
4. Write a program for multiplication of two matrices using OOPs

5. Create a class time with members hours, minutes and seconds. Take
input and add two time objects passing objects to functions and
display results.

6. Create a class student which has data members as name, branch, roll
no., age, gender, and marks in 5 subjects. Display the names of the
students and his percentage who has more than 70%. Use an array
objects.

7. Write a program to enter a number and find its factorial using


constructor.
8. Write a program to perform addition of two complex numbers
constructor overloading. The first constructor which takes no
arguments is used to create new objects which are not initialized,
second which takes one argument is used to initialize real and
imaginary parts to equal values and third which takes two arguments is
used to initialize real and imaginary parts to two different values.

9. Write a program to generate a Fibonacci series using a copy


constructor.

10 Write a program to find the biggest of three numbers using friend function.

11. Write a program to demonstrate the use of friend function with Inline
assignment.

12. Write a program to find the greatest of two given numbers in two different
classes using friend function.

13. Imagine a publishing company that markets both book and audiocassette
versions of its works. Create a class publication that stores the title (a
string) and price (type float) of a publication. From this class derive two
classes: book, which adds a page count (type int), and tape, which adds a
playing time in minutes (type float). Each of these three classes should
have a getdata() function to get its data from the user at the keyboard,
and a putdata() function to display its data. (Simple inheritance &
method overriding)

14. C++ program to read and print employee information using multiple
inheritance. The program has following classes:
1. basicInfo
a. Data: name[char,30],empId[int], gender[char]
b. Functions: getData(), putData();
2. deptInfo
a. Data: deptName[char,30], assignWork[char,30], timeToComplete(int)
b. Functions: getData(), putData();
3. employeeInfo
a. Data: salary[int], age[int]
b. Functions: getData(), putData();

15. Design three classes STUDENT ,EXAM and RESULT. The STUDENT
class has data members such as rollno, name. create a class EXAM by
inheriting the STUDENT class. The EXAM class adds data members
representing the marks scored in six subjects. Derive the RESULT from
the EXAM class and has its own data members such as total marks. Write
a program to model this relationship.

16. Create class first with data members book no, book name and member
function getdata and putdata. Create a class second with data members
author name ,publisher and members getdataand showdata. Derive a class
third from first and second with data member no of pages and year of
publication. Display all these information using an array of objects of third
class.
17. Create a base class called SHAPE. Use this class to store two double type
values. Derive two specific classes called TRIANGLE and RECTANGLE
from the base class. Add to the base class, a member function getdata to
initialize base class data members and another member function display to
compute and display the area of figures. Make display a virtual function
and redefine this function in the derived classes to suit their requirements.
Using these three classes design a program that will accept driven of a
TRIANGLE or RECTANGLE interactively and display the area.
18. Create a base class basic_info with data members name ,roll no, gender
and two member functions getdata and display. Derive a class physical_fit
from basic_info which has data membersheight and weight and member
functions getdata and display. Display all the information using object of
derived class.
19. Write a program to overload less than (<) operators.

20. Write a program to overload binary + operator.

21. Write a program to overload binary [*] operator.

22. Write a program to define the function template for swapping two items of
the various data types such as integer ,float,and characters.

23. Write a program to define the function template for calculating the square
of given numbers with different data types.

24. Write a program to illustrate how template functions can be overloaded.

25. Write a program to illustrate how to define and declare a class template for
reading two data items from the keyboard and to find their sum.

26. Write a program to demonstrate the use of special functions, constructor


and destructor in theclass template. The program is used to find the biggest
of two entered numbers.

27. Write a program to read a set of lines from the keyboard and to store it on
a specified file.

28. Write a program to read a text file and display its contents on the screen.

29. Write a program to copy the contents of a file into another.

30. Write a program to read the class object of student_info such as name , age
,sex ,height and weight from the keyboard and to store them on a specified
file using read() and write() functions. Again the same file is opened for
reading and displaying the contents of the file on the screen.
LAB FILE OF

OBJECT ORIENTED PROGRAMMING


CIC-257

Faculty name: Mrs. Seema Kalonia Student name : Sumit Singh


Roll No.: 05114803121
Group: I1
Semester: 3r

Maharaja Agrasen Institute of Technology, PSP


Area, Sector - 22, Rohini, New Delhi - 110085
PRACTICAL DETAILS

S no. Experiment Name Date Signature

1. Write a program to take name, address as a character array age as


integer, salary as float and contains inline function to set the values
and display it in class

2. Using the concept of function overloading write function for


calculating area of triangle, circle rectangle.

3. Write a program to find number m to power n. The function power


takes a double variable for m and int value for n. Use default values
for n to make the function to calculate squares when this argument is
omitted.
4. Write a program for multiplication of two matrices using OOPs

5. Create a class time with members hours, minutes and seconds. Take
input and add two time objects passing objects to functions and
display results.

6. Create a class student which has data members as name, branch, roll
no., age, gender, and marks in 5 subjects. Display the names of the
students and his percentage who has more than 70%. Use an array
objects.

7. Write a program to enter a number and find its factorial using


constructor.
8. Write a program to perform addition of two complex numbers
constructor overloading. The first constructor which takes no
arguments is used to create new objects which are not initialized,
second which takes one argument is used to initialize real and
imaginary parts to equal values and third which takes two arguments is
used to initialize real and imaginary parts to two different values.

9. Write a program to generate a Fibonacci series using a copy


constructor.

10 Write a program to find the biggest of three numbers using friend function.
11. Write a program to demonstrate the use of friend function with Inline
assignment.

12. Write a program to find the greatest of two given numbers in two different
classes using friend function.
13. Imagine a publishing company that markets both book and audiocassette
versions of its works. Create a class publication that stores the title (a
string) and price (type float) of a publication. From this class derive two
classes: book, which adds a page count (type int), and tape, which adds a
playing time in minutes (type float). Each of these three classes should
have a getdata() function to get its data from the user at the keyboard,
and a putdata() function to display its data. (Simple inheritance &amp;
method overriding)

14. C++ program to read and print employee information using multiple
inheritance. The program has following classes:
1. basicInfo
a. Data: name[char,30],empId[int], gender[char]
b. Functions: getData(), putData();
2. deptInfo
a. Data: deptName[char,30], assignWork[char,30], timeToComplete(int)
b. Functions: getData(), putData();
3. employeeInfo
a. Data: salary[int], age[int]
b. Functions: getData(), putData();
15. Design three classes STUDENT ,EXAM and RESULT. The STUDENT
class has data members such as rollno, name. create a class EXAM by
inheriting the STUDENT class. The EXAM class adds data members
representing the marks scored in six subjects. Derive the RESULT from
the EXAM class and has its own data members such as total marks. Write
a program to model this relationship.
16. Create class first with data members book no, book name and member
function getdata and putdata. Create a class second with data members
author name ,publisher and members getdataand showdata. Derive a class
third from first and second with data member no of pages and year of
publication. Display all these information using an array of objects of third
class.
17. Create a base class called SHAPE. Use this class to store two double type
values. Derive two specific classes called TRIANGLE and RECTANGLE
from the base class. Add to the base class, a member function getdata to
initialize base class data members and another member function display to
compute and display the area of figures. Make display a virtual function
and redefine this function in the derived classes to suit their requirements.
Using these three classes design a program that will accept driven of a
TRIANGLE or RECTANGLE interactively and display the area.

18. Create a base class basic_info with data members name ,roll no, gender
and two member functions getdata and display. Derive a class physical_fit
from basic_info which has data membersheight and weight and member
functions getdata and display. Display all the information using object of
derived class.
19. Write a program to overload less than (<) operators.

20. Write a program to overload binary + operator.


21. Write a program to overload binary [*] operator.
22. Write a program to define the function template for swapping two items of
the various data types such as integer ,float,and characters.

23. Write a program to define the function template for calculating the square
of given numbers with different data types.
24. Write a program to illustrate how template functions can be overloaded.
25. Write a program to illustrate how to define and declare a class template for
reading two data items from the keyboard and to find their sum.
26. Write a program to demonstrate the use of special functions, constructor
and destructor in theclass template. The program is used to find the biggest
of two entered numbers.

27. Write a program to read a set of lines from the keyboard and to store it on
a specified file.

28. Write a program to read a text file and display its contents on the screen.

29. Write a program to copy the contents of a file into another.

30. Write a program to read the class object of student_info such as name , age
,sex ,height and weight from the keyboard and to store them on a specified
file using read() and write() functions. Again the same file is opened for
reading and displaying the contents of the file on the screen.

You might also like