0% found this document useful (0 votes)
52 views

Lab Manual - 2023-24

Uploaded by

nogati3383
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views

Lab Manual - 2023-24

Uploaded by

nogati3383
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

G.H.

Patel of College of Engineering and Technology


Department of Computer Engineering

Vision
To produce globally competitive computer engineers, who are prepared to accept the challenges at
professional level, while maintaining the core values.

Mission
✓ To create excellent teaching learning environment.
✓ To mould engineers with a strong foundation of scientific knowledge and engineering concepts.
✓ To enhance the acquired concepts and develop new technology through excellence in research.
✓ To assist nation building and elevating the quality of life of the people through leadership in
professionalism, education, research and public services.

Programme Educational Objectives (PEO)


✓ To educate young aspirants with the fundamentals of engineering and knowledge of latest
technologies.
✓ To encourage the students to remain updated by pursuing higher degree or certification programs.
✓ To assume management and leadership roles to contribute in socio-economic development of the
nation.
G H Patel College of Engineering and Technology
Department Of Computer Engineering
A.Y. 2023-24(EVEN), SEMESTER 2

SUBJECT CODE: 202000212

SUBJECT NAME: OBJECT ORIENTED PROGRAMMING

INDEX

NAME:

ENROLMENT NO: BRANCH:

Sr.
Page
Name of the Experiment Date Marks Signature
No.
No

• Write a program to input a single character and print a


message “It is a vowel” if it is a vowel otherwise print “It is
a consonant” using if-else structure and OR (||) operator.
• Write a program that prints the tables from 1 to 12.
1. • Write a program to display the following output using a single
cout statement.
Maths = 90, Physics = 77, Chemistry = 69
• Design a simple class to perform basic arithmetic functions.
Use them in main() function.

• Write a program that creates an array of user given size


using new operator. Initialise and display the array elements.
• Write a program that uses a structure that stores the three
parts of a phone number separately. For ex: 91 02692 229393
should be printed as (91)02692-229393
• Design classes named Triangle, Square, and Circle. Create
2.
functions in each class to find areas of particular shape.
• Define a class to represent a bank account. Include the
members like name of the depositor, account number, type of
account, and balance amount in the account. Make functions
(1) To assign initial values, (2) To deposit an amount, (3) To
withdraw an amount after checking the balance, (4) To
display name and balance. Write a main program to test the
program.

• Create a C++ program to convert temperature from


Fahrenheit to Celsius and display. Use class.
• Write a function that creates a vector of user given size M
3.
using new operator. Demonstrate the use of the function.
• Write a C++ program to swap two number by both call by
value and call by reference mechanism, using two functions
swap_value() and swap_reference respectively , by getting
the choice from the user and executing the user’s choice by
switch-case.
• Write a program to find the largest of three integers using a
swap function. The function accepts integer arguments by
reference.
• Sample program for default arguments (ex: calculating
interest from principal amount, rate of interest and time)
• Create a function called reverse () that takes two parameters.
The first parameter, called str is a pointer to a string that will
be reversed upon return from the function. The second
4.
parameter is called count, and it specifies how many
characters of str to reverse. Give count a default value that,
when present, tells reverse () to reverse the entire string.
• Write a C++ program to implement function overloading in
order to compute power(m,n) where
m is double and n is int
m and n are int.
• Write a program to demonstrate the use of arrays within a
class. Create and manage an inventory system.
• Create a program to understand and use static members and
static member functions.
• Create a class employee with suitable members and
functions. Create an array of objects and demonstrate the use
of the class using the main function.
5. • Create a class time with members hours and minutes. Write a
member function ‘add’ which takes 2 arguments of type class
time and demonstrate the use with a main program.
• Create a 'DISTANCE' class with: - feet and inches as data
members, - member function to input distance- member
function to output distance- member function to add two
distance objects. Write a main function to create objects of
DISTANCE class. Input two distances and output the sum.
• Create a class sample with members a and b of type integer.
Write a friend function that takes an object as argument and
calculates the mean of the two members.
6.
• Create a class complex that has two members of type float.
Write a friend function that calculate the sum of the two
complex objects and returns the result as an object.
Demonstrate the working using a main function.
• Create a class with string pointer as data member and member
functions: Constructor to allocate memory dynamically and
read value. Display() function to display the string.
7.
Destructor function to free allocated memory.
• For the complex Class, demonstrate the use of multiple
constructors.
• Write a program to demonstrate the use of copy constructor
• Write a program to overload the + and – operators for the
complex class.
• Write a program to overload the unary – operator for a
8. suitable class.
• Write a program to overload the + and == operators for the
string class.
• Write a program to overload the [] operator.
9. • Write a program to overload the << and >> operators.
• Write a program to convert a basic type to a class type and
vice versa.
• Write a program to convert an object of one class to another
class.
• Design a class Polar which describes a point in the plane
using polar coordinates radius and angle. Use overloaded +
10.
operator to add two polar objects.
• Define two classes Polar and Rectangle to represent points in
the polar and rectangular systems. Use conversion routines to
convert from one system to the other.
• Write a program to implement single inheritance. Show the
consequences of deriving a class in public, protected and
private manner with a simple example.
• Consider a simple example. Class student stores the roll-
number, class test stores the marks in two subjects and class
11. result contains the total marks obtained in the test. The class
result inherits the details of the marks obtained and rolls
number of students through multilevel inheritance. Write a
program to demonstrate the above.
• Write a program to implement multiple inheritance. Show
with an example, how, ambiguity if any is resolved.
• Extend the program in (2) to add a sports class. The result
class inherits the details of marks obtained from class test and
12.
the performance in sports from the sports class (hybrid
inheritance).
• Write a program to demonstrate how parameters are passed
to the base class constructor via the derived class constructor.
• Write a program to understand the use of this pointer.
• Write program to use a base class pointer to point to the
derived class object.
13. • Write a program to understand the use of virtual functions.
Class media-the base class, two derived classes, tape and
book.
• Write a program to understand the use of pure virtual
functions.
• Write a program to use the following functions
o Put()
o Get()
o Getline()
o Write()
• Write a program to produce formatted output using the
following functions
o Width()
o Precision()
14.
o Fill()
o Setf()
o Unsetf()
Use various flags and bit fields to produce formatted
output.
• Write a program to use manipulators setw, setiosflags and
setprecision for formatted output.
• Write a program to read a list containing item name, item
code, and cost interactively and produce a three column
output as shown below.
NAME CODE COST
____________________________
Turbo C++ 1001 250.95
C Primer 905 95.70
….. … ..…
….. … …..
____________________________

• Write a program to create files with constructor function,


open function, and using various file mode parameters.
• Write a program to use the following functions:
o Seekg()
o Tellg()
15. o Seekp()
o Tellp()
o Put()
o Get()
o Write()
o Read()
G H Patel College of Engineering and Technology
Department Of Computer Engineering
A.Y. 2023-24(EVEN), SEMESTER 2

SUBJECT CODE: 202000212

SUBJECT NAME: OBJECT ORIENTED PROGRAMMING

INDEX

NAME:

ENROLMENT NO: BRANCH:

Sr. Page
List of Assignment Date Marks Signature
No No.

1.
Assignment-1

2.
Assignment-2

3.
Assignment-3

4.
Assignment-4

You might also like