DAV Institute of Engineering & Technology,
Jalandhar
Department of Computer and Application
BACHELOR OF COMPUTER APPLICATIONS
PRACTICAL FILE
Object Oriented Programming using C++ Laboratory
(UGCA1910)
Submitted To : Submitted By:
Mrs. Shefali Khanna Name – Arman Sharma
(Assistant Professor) Roll No. - 2427357
INDEX
Sr. Particulars Page Date Signature
No. No.
1. Write a program to enter mark of 6 different subjects and 01 05-03-25
find out the total mark (Using cin and cout statement)
2. Write a function using reference variables as arguments 02 05-03-25
to swap the values of pair of integers.
3. Write a function to find largest of three numbers. 03 05-03-25
4. Write a program to find the factorial of a number. 04 05-03-25
5. Define a class to represent a bank account which includes
the following members as Data members: a) Name of the 05
depositor b) Account Number c) Withdrawal amount d)
Balance amount in the account Member Functions: a) To to 05-03-25
assign initial values b)To deposit an amount c) To
withdraw an amount after checking the balance d) To
display name and balance. 08
6. Write the above program for handling n number of 09
account holders using array of objects. to 21-03-25
11
7. Write a C++ program to compute area of right angle
triangle, equilateral triangle, isosceles triangle using 12 21-03-25
function overloading concept.
8. Consider a publishing company that markets both book
and audio cassette version to its works. Create a class
Publication that stores the title (a string) and price (type 13
float) of a publication. Derive the following two classes
from the above Publication class: Book which adds a page
count (int) and Tape which adds a playing time in
to 07-04-25
minutes(float). Each class should have get_data() function
to get its data from the user at the keyboard. Write the
main() function to test the Book and Tape classes by
creating instances of them asking the user to fill in data 15
with get_data() and then displaying it using put_data()
9. Consider an example of declaring the examination result.
Design three classes student, exam and result. The 16
student has data members such as rollno, name. Create
the lass exam by inheriting the student class. The exam to 09-04-25
class adds data members representing the marks scored in
5 subjects. Derive the result from exam-class and it has 18
own data members like total, avg
10. Write a program for overloading of Unary ++ operator 19
to 10-04-25
20
11. Write a program for overloading of Binary ++ operator 21 10-04-25
12. Write a program of Virtual Functions. 21 15-04-25
13. Write a program of Abstract Classes. 22 15-04-25
14. Write a program to read and write from file. 23,24 15-04-25
Object Oriented Programming using C++ Laboratory UGCA1910
Q.1. Write a program to enter mark of 6 different subjects and find out the
total mark (Using cin and cout statement).
INPUT
OUTPUT
Page No. – 01
Object Oriented Programming using C++ Laboratory UGCA1910
Q.2. Write a function using reference variables as arguments to swap the
values of pair of integers.
INPUT
OUTPUT
Page No. - 02
Object Oriented Programming using C++ Laboratory UGCA1910
Q.3. Write a function to find largest of three numbers.
INPUT
OUTPUT
Page No. - 03
Object Oriented Programming using C++ Laboratory UGCA1910
Q.4. Write a program to find the factorial of a number.
INPUT
OUTPUT
Page No. - 04
Object Oriented Programming using C++ Laboratory UGCA1910
Q.5. Define a class to represent a bank account which includes the following
members as Data members: a) Name of the depositor b) Account Number c)
Withdrawal amount d) Balance amount in the account Member Functions: a)
To assign initial values b)To deposit an amount c) To withdraw an amount
after checking the balance d) To display name and balance.
INPUT
Page No. - 05
Object Oriented Programming using C++ Laboratory UGCA1910
Page No. - 06
Object Oriented Programming using C++ Laboratory UGCA1910
OUTPUT
Page No. - 07
Object Oriented Programming using C++ Laboratory UGCA1910
Page No. - 08
Object Oriented Programming using C++ Laboratory UGCA1910
Q.6. Write the above program for handling n number of account holders using
array of objects.
INPUT
Page No. - 09
Object Oriented Programming using C++ Laboratory UGCA1910
Page No. - 10
Object Oriented Programming using C++ Laboratory UGCA1910
OUTPUT
Page No. - 11
Object Oriented Programming using C++ Laboratory UGCA1910
Q.7. Write a C++ program to compute area of right angle triangle, equilateral
triangle, isosceles triangle using function overloading concept.
INPUT
OUTPUT
Page No. - 12
Object Oriented Programming using C++ Laboratory UGCA1910
Q.8. Consider a publishing company that markets both book and audio cassette version to
its works. Create a class Publication that stores the title (a string) and price (type float) of a
publication. Derive the following two classes from the above Publication class: Book which
adds a page count (int) and Tape which adds a playing time in minutes(float). Each class
should have get_data() function to get its data from the user at the keyboard. Write the
main() function to test the Book and Tape classes by creating instances of them asking the
user to fill in data with get_data() and then displaying it using put_data().
INPUT
Page No. - 13
Object Oriented Programming using C++ Laboratory UGCA1910
Page No. - 14
Object Oriented Programming using C++ Laboratory UGCA1910
OUTPUT
Page No. - 15
Object Oriented Programming using C++ Laboratory UGCA1910
Q.9. Consider an example of declaring the examination result. Design three
classes student, exam and result. The student has data members such as rollno,
name. Create the lass exam by inheriting the student class. The exam class
adds data members representing the marks scored in 5 subjects. Derive the
result from exam-class and it has own data members like total, avg.
INPUT
Page No. - 16
Object Oriented Programming using C++ Laboratory UGCA1910
Page No. - 17
Object Oriented Programming using C++ Laboratory UGCA1910
OUTPUT
Page No. - 18
Object Oriented Programming using C++ Laboratory UGCA1910
Q.10. Write a program for overloading of Unary ++ operator.
INPUT
Page No. – 19
Object Oriented Programming using C++ Laboratory UGCA1910
OUTPUT
Page No. – 20
Object Oriented Programming using C++ Laboratory UGCA1910
Q.11. Write a program for overloading of Binary ++ operator.
INPUT
OUTPUT
Page No. – 21
Object Oriented Programming using C++ Laboratory UGCA1910
Q.12. Write a program of Virtual Functions.
INPUT
OUTPUT
Page No. - 22
Object Oriented Programming using C++ Laboratory UGCA1910
Q.13. Write a program of Abstract class.
INPUT
OUTPUT
Page No. - 23
Object Oriented Programming using C++ Laboratory UGCA1910
Q.14. Write a program to read and write frem a file.
INPUT
Page No. - 24
Object Oriented Programming using C++ Laboratory UGCA1910
OUTPUT
Page No. - 25