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

Practical Set-OOP

Uploaded by

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

Practical Set-OOP

Uploaded by

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

VIDYALAN

THIRD SEM COMPUT

Sr. No Roll ID Student Name Grp no


1

2
G1

5
6
G2
7

10
G3
11

12

13

14
G4
15

16

17
18
19 G5

20
VIDYALANKAR POLYTECHNIC

THIRD SEM COMPUTER ENGINEERING (CO3K)

Week1 : Set 1
Exp 1 Exp 2
1. Write a C++ program to evaluate the following Write programs usingScope resolution
expressions: operator
Memory management operator
Manipulators 1) To access a global variable
when there is a local variable with same
name

2.Write a c++ program to take input name and age


from user and display on screen.

1. Write a C++ program to evaluate the following Write programs usingScope resolution
expressions: C1 = [(x1 + x2 + x3)/ 3,C2= (y1 + y2 + operator
y3)/ 3] Memory management operator
Manipulators 2) To define a function
outside a class.
2.Write a c++ program to take input rollnumber
and marks score in all subject of second semester
from user and display on screen.

1. Write a C++ program to evaluate the following


expressions: a1 = 3xy^2 + 5yz^4 – 7x^3z + 1,a2= -
4xy + 2yz^3 – 2x^4z + 5xy^2z + 1
Write programs usingScope resolution
operator
2.Write a c++ program to take personal details Memory management operator
from user and display on screen. Manipulators 3) To access a class’s static
variables.
Write programs usingScope resolution
1. Write a C++ program to evaluate the following
operator
expressions: r= 7ab^2 c^2 + 2a^3b^2 − 3abc –
Memory management operator
5ab^2c^2 – 2b^2a^3 + 2ab
Manipulators 4) To use new operator

2.Write a c++ program to take medical details from


user and display on screen.

1. Write a C++ program to evaluate the following Write programs usingScope resolution
expressions: y=50x^3 – 20xyz + 8x + 21x^3z – 3xw operator
+ 15x – 41x^3 Memory management operator
Manipulators 5) To use delete operator
2.Write a c++ program to take educational details
from user and display on screen.
Week2 : Set 2
Exp 3 Exp 4
Write programs to demonstrate use
ofImplicit type casting
Explicit type casting 1) Integer to
Floating Point:
Write programs to show use of classes and
objects to define the function inside the class
1)Initialize and Display Student data through
method

Write programs to demonstrate use


ofImplicit type casting
Explicit type casting 2) Smaller Data Write programs to show use of classes and
Type to Larger Data Type objects to define the function inside the class
2)Initialize and Display Employee data through
method

Write programs to demonstrate use


ofImplicit type casting
Explicit type casting 3) Character to Write programs to show use of classes and
Integer objects to define the function inside the class
3)Initialize and Display Car data through
method

Write programs to demonstrate use


ofImplicit type casting
Explicit type casting 4) Boolean to Write programs to show use of classes and
Integer objects to define the function inside the class
4)Initialize and Display Smartphone data
through method

Write programs to demonstrate use


ofImplicit type casting
Explicit type casting 5) Integer to String Write programs to show use of classes and
objects to define the function inside the class
5)Initialize and Display Bike data through
method

1. Define a class Room with data members


length, breadth and height. Member function
calculate_area () and calculate_volume().
Calculate the area and volume of room . Define
the member function inside the class.
2. Define a class mean in which assign two
numbers in assign member function (i.e.
assign(4,8)) passed value from main function
and define assign member function inside the
class and display the mean of two number on
output screen.
Week3 : Set 3
Exp 5
Write programs to implement friend
function usingTwo different classes
External function 1)Global Function as Friend
Function

Write programs to implement friend


function usingTwo different classes
External function 2)Member Function of Another
Class as Friend Function
Write
programs
to
implemen
Write programs to implement friend t friend
function usingTwo different classes function
External function 3)when the function is friendly usingTwo
to two classes. different
classes
External
function
3)when
the
Write programs to implement friend function
function usingTwo different classes is friendly
External function 4)Friend Function to Calculate to two
Average of numbers classes.

Write programs to implement friend


function usingTwo different classes
External function 5)Friend Function to Calculate
volume of box
VIDYALANKAR POLYTECHNIC

THIRD SEM COMPUTER ENGINEERING

Sr. No Roll ID Student Name Grp no


1
2
3 G1

5
6
G2
7

10
11 G3

12

13

14
G4
15

16

17
18
19 G5

20
VIDYALANKAR POLYTECHNIC

THIRD SEM COMPUTER ENGINEERING (CO3K)

Week4 : Set 4 Week5 : Set 5


Exp 6 Exp 7
Write a C++ program to exchange the
Write a C++ program to create a class values of two variables using friend
"Number" having data members n1 and n2 and function.
perform mathematical operations like addition,
subtraction, multiplication and division on two
numbers using inline functions.

Write a C++ program to define a class


Distance having data member as meters.
Write a C++ program to create a class Cube. Display the addition of two Distance
Accept data and print cube of input number objects using friend function.
using inline function.

WAP to create two classes test1 and test2


which stores marks of a student. Read
value for class objects and calculate
write a c++ program to create a class average of two tests using friend function.
circle.Accept data and print circle circle of
input number using inline function.

Write a C++ program to find greatest


number among two numbers from two
Write a C++ program to create a class Square. different classes using friend function.
Accept data and print square of input number
using inline function.

Write a C++ program to declare two classes


with data members as m1 and m2
respectively. Use friend function to
Write a C++ program to calculate area of calculate average of two (m1, m2) marks
Rectangle using Inline function. and display it.
Week5 : Set 5 Week6 : Set 6
Exp 8 Exp 9
Write a C++ program to count number of students in a Write a C++ program to declare class
class with the help of static data member. ‘Account’ having data members as
Account_No and Balance. Accept this data for
10 accounts and display data of Accounts
having balance greater than 10000.

Write C++ program to count number of objects created Write a program to declare a class ‘employee’
with the help of static data member. containing data members ‘emp-id’ and ‘salary’.
Accept and display this data for 10 employees.

Write a Program to calculate weight of object at Write a Program to declare a class birthday
different planets using formula weight=m*g having data member day, month and year. Accept
Where m=mass of object G=gravitational force this info for object using pointer to array of object
Declare g as static member variable. and display it.

Write A C++ program to count number of employees Write a C++ program to declare a class mobile
in an oganization using static data member. having data members as price and model number.
Accept and display the data for Ten objects

Write a Program to define a class having data Write a program to declare a class ‘student’
members principal, duration and rate of interest. having data members as ‘stud_name’ and
Declare rate _of_ interest as static member ‘roll_no’. Accept and display this data for 5
variable .calculate the simple interest and display it. students.
Week6 : Set 6
Exp 10
WAP to declare a class student having
datamembers as name and percentage .Write
constructor to initialise these data members.
Accept and display data for one object.

Write a program to declare a class measure having


data members add1, add2 and add3. Initialize the
data members using
constructor and store their addition in third data
member using
function and display the addition.

WAP to implement default constructor that


initializes num1 and num2 as 10 and 20 and prints
the values of num1 and num2.

WAP to declare class time having data members


as hrs, min,sec. Write a constructor to accept data
and display for two objects.

Define a class student having data members as


rollno ,name and course. Write a program using
constructor as "Information Technology" for
course . Accept this data for objects of class and
display the data.
.

THIRD SEM COMPUTER ENGINEERING (C

Sr. No Roll ID Student Name Grp no


1

3 G1

G2
7

10

G3
11

12

13

G4
14

15 G4

16

17

18

19 G5

20
.

THIRD SEM COMPUTER ENGINEERING (CO3K)

Week 7 : Set 7 Week 8 : Set 8


Exp 11 Exp 12
Write programs to implement multiple
inheritance:Create two base classes Shape and
Write programs using Single level inheritance: Paintable. The Shape class should have a
Create a derived class called Typist that method area() and the Paintable class should
inherits from Staff have a method paint(). Create a derived class
PaintedShape that inherits from both Shape
and Paintable. Implement the area() method
to return the area of a rectangle and the
paint() method to print "Painting the shape".
Write programs using Multilevel
inheritance:Create a C++ program to show
how data members and member functions are
inherited through multiple levels. Use classes
Vehicle, Car, and SportsCar.

Write programs to implement multiple


inheritance:Create a banking transaction
Write programs using Single level inheritance: system where different types of accounts
Create a derived class called Result that inherit attributes and behaviors from multiple
inherits from Student base classes. Use multiple inheritance to
model relationships between accounts and
their transaction capabilities.

Write programs using Multilevel


inheritance:Design a class hierarchy using
multilevel inheritance to model a school
system with classes Person, Student, and
GraduateStudent.

Write programs to implement multiple


inheritance:Design a vehicle rental system
Write programs using Single level where different types of vehicles inherit
inheritance:Create a derived class called common attributes and behaviors from
Account that inherits from Bank multiple base classes. Use multiple inheritance
to model the relationships between vehicles
and their categories.

Write programs using Multilevel


inheritance:C++ program that uses multilevel
inheritance to model a simple library system
with classes Publication, Book, and
DigitalBook. Include appropriate member
functions and data members.

Write programs to implement multiple


inheritance:Create an academic grading
Write programs using Single level system where different types of students
inheritance:Create a derived class called Brand inherit attributes and behaviors from multiple
that inherits from Vehicle base classes. Use multiple inheritance to
model relationships between students and
their academic statuses.
Write programs to implement multiple
inheritance:Create an academic grading
Write programs using Single level system where different types of students
inheritance:Create a derived class called Brand inherit attributes and behaviors from multiple
that inherits from Vehicle base classes. Use multiple inheritance to
model relationships between students and
their academic statuses.

Write programs using Multilevel


inheritance:Design a class hierarchy using
multilevel inheritance to model a university
system with classes Person, Faculty, and
Professor. Include appropriate member
functions.

Write programs to implement multiple


inheritance:Design a social media analytics
Write programs using Single level system where different types of users inherit
inheritance:Create a derived class called attributes and behaviors from multiple base
Employee that inherits from Company classes. Use multiple inheritance to model
relationships between users and their
activities.

Write programs using Multilevel


inheritance:Write a C++ program to
demonstrate multilevel inheritance using
classes Device, Phone, and Smartphone.
Include member functions to display the type
of device.
Week 8 : Set 8 Week 9 : Set 9
Exp 13 Exp 14 and 15
Write programs to implement hierarchical
inheritance:Create a base class Animal with a method Write programs to implement virtual base
sound(). Derive two classes Dog and Cat from Animal. class:Design an employee management system
Override the sound() method in both derived classes where multiple types of employees inherit
to print appropriate sounds for a dog and a cat. In the common attributes and methods from a base
main function, create objects of Dog and Cat and call class.
their sound() methods.

Write programs which show the use of


constructors in derived class:Create an online
shopping system where different types of
products inherit common attributes from a base
class. Use constructors in derived classes to
initialize these attributes.

Write programs to implement hierarchical


inheritance:Create a base class Person with a *Write programs to implement virtual
constructor that initializes the name and a method base class:Design a vehicle inheritance
display(). Derive two classes Student and Teacher hierarchy with a virtual base class to
from Person. Each derived class should have its own
constructor that initializes additional information avoid redundancy in attributes shared
specific to a student or a teacher and should override across multiple types of vehicles.
the display() method to show all relevant information.
Demonstrate the functionality in the main function.
Write programs which show the use of
constructors in derived class:Design a sports
team management system where different types
of team members inherit common attributes
from a base class. Use constructors in derived
classes to initialize these attributes.

Write programs to implement hierarchical Write programs to implement virtual


inheritance:Create a base class Shape with an base class:Design an academic
overloaded method area(). Derive two classes institution system where different roles
Rectangle and Circle from Shape. Implement the
area() method in both derived classes to calculate the (e.g., students, teachers) share
area of the respective shapes. In the main function, common attributes. Use virtual
create objects of Rectangle and Circle and call their inheritance to manage these shared
area() methods. attributes efficiently.
Write programs which show the use of
constructors in derived class:Design a vehicle
hierarchy where different types of vehicles
inherit common attributes from a base class. Use
constructors in derived classes to initialize these
attributes.

Write programs to implement hierarchical *Write programs to implement virtual


inheritance:Create a base class Employee with private, base class:Design a hierarchy of
protected, and public members. Derive two classes electronic devices where multiple types
Manager and Engineer from Employee. Each derived of devices inherit common attributes
class should have a method to access and modify the
protected and public members of Employee. and methods from a base class. Use
Demonstrate the functionality in the main function. virtual inheritance to handle shared
attributes.
Write programs to implement hierarchical *Write programs to implement virtual
inheritance:Create a base class Employee with private, base class:Design a hierarchy of
protected, and public members. Derive two classes electronic devices where multiple types
Manager and Engineer from Employee. Each derived of devices inherit common attributes
class should have a method to access and modify the
protected and public members of Employee. and methods from a base class. Use
Demonstrate the functionality in the main function. virtual inheritance to handle shared
attributes.

Write programs which show the use of


constructors in derived class:Create a library
system where different types of books inherit
common attributes from a base class. Use
constructors in derived classes to initialize these
attributes.

Write programs to implement hierarchical Write programs to implement virtual


inheritance:Create a base class Vehicle with a function
description(). Derive two classes Car and Bike from base class:Design a library system
Vehicle. Demonstrate the functionality in the main where books and magazines share
function. common attributes. Use virtual
inheritance to manage these shared
attributes without redundancy.

Write programs which show the use of


constructors in derived class:Create a wildlife
management system where different types of
animals inherit common attributes from a base
class. Use constructors in derived classes to
initialize these attributes.
Week 10 : Set 10
Exp 16
Write programs to implementPointer to object
'this' pointer:Create a class Rectangle with private
member variables length and width. Write a
member function setDimensions that uses the
this pointer to set the dimensions of the
rectangle. Also, write a member function
displayDimensions to print the dimensions.

Write programs to implementPointer to object


'this' pointer:Write programs to
implementPointer to object 'this' pointer:we
create a College class and use the "this" pointer
to set and display the dimensions of the
rectangle.

Write programs to implementPointer to object


'this' pointer:Create a class Box with private
member variables length, width, and height.
Write a member function isEqual that compares
the dimensions of the current object with
another Box object using the this pointer.

*Write programs to implementPointer to object


'this' pointer:we create a triangle class and use
the "this" pointer to set and display the
dimensions of the rectangle.
*Write programs to implementPointer to object
'this' pointer:we create a triangle class and use
the "this" pointer to set and display the
dimensions of the rectangle.

Write programs to implementPointer to object


'this' pointer:Write programs to
implementPointer to object 'this' pointer:we
create a employee class and use the "this"
pointer to set and display the dimensions of the
rectangle.
VID

THIRD SEMESTER

Sr. No Roll ID Student Name Grp no

2
G1

6
G2

10
G3

11

12

13

14
G4

15

16
17

18
G5

19

20
VIDYALANKAR POLYTECHNIC

THIRD SEMESTER COMPUTER ENGINEERING (CO3K)


Week 10 : Set 10
Exp 17 Exp 18
1. Write a C++ program declare a class 1.Write a C++ program to overload add
“polygon” having data members width function to add two integer numbers
and and two float numbers.
height. Derive classes “rectangle” from
“polygon” having area() as
a member function. Calculate area of
rectangle using pointer to
derived class object.

1. Write a C++ program to declare a 1.Write a C++ program to swap two


class train with members as train no integer numbers and swap two float
and name. Accept and display data for numbers using function overloading.
one object of train. Use pointer to
object to call functions of class.

1. Write a C++ program declare a class 1.Write a C++ program to overload


“Vehicle” . Derive classes “Car” from multiplication function to multiply two
“Vehicle” having mileage() as integer numbers and two float
a member function. Calculate mileage numbers.
of Car using pointer to
derived class object.

1. Write a C++ program declare a class 1.Write C++ program to find the area of
“Animal” having data members various geometrical shapes by Function
nooflegs and sound. Derive classes overloading. (eg.Area of circle,
“Dog” from “Animal” having display() as circumference of circle etc…)
member function. Display details of
Dog using pointer to derived class
object.
1. Write a C++ program declare a class 1.Write C++ program to find the
“Fruit” having data members taste and hightNumber of various Number by
size. Derive classes “Apple” from “Fruit” Function overloading. (eg.three
having display() as member function. integer,four floating point number
Display details of Apple using pointer to etc…)
derived class object.
YTECHNIC

GINEERING (CO3K)
Week 11 : Set 11
Exp 19 Exp 20
1. Write a C++ program to overload 1. Write a C++ program to add two
Unary Operator ++ used as prefix. complex numbers using operator
overloading by a friend function.

1. Write a C++ program to create class 1. Write a C++ program to subtract two
distance takes two member objects i.e. complex numbers using operator
feet and inches, and creates a function overloading by using member function.
by which the Distance object should
decrement the value of feet and inches
by overloading Unary Operator (- ) .

Write a program in C++ to overload 1. Write a C++ program to compare two


unary ‘-’ operator to negate values of strings using'==' operator overloading.
data members of class.

1. Write a C++ program to create class 1. Write C++ program to overload


distance takes two member objects i.e. binary operator ‘+’ to concatenate
feet and inches, and creates a function two strings.
by which the Distance object should
increment the value of feet and inches
by overloading Unary Operator (+) .
1. Write a C++ program to overload 1. Write a C++ program to subtract two
Unary Operator (-) using friend complex numbers using operator
function. overloading by using friend function.
Week 12 : Set 12
Exp 21 and Exp 22
1. Write a C++ program declare a class 1. Write a C++ program declare a class
“Animal” having sound() as a member “polygon” having data members width
function. Create class Cat to inherit and
class Animal using virtual function. height and pure virtual function area()
as
a member function. Create class
Triangle to inherit class polygon.

1. Write a C++ program declare a class 1. Write a C++ program declare a class
“Shape” having data members width “Animal” having pure virtual function
and sound() as a member function. Create
height and area() as class Cat to inherit class Animal.
a member function. Create class
Rectangle to inherit class Shape using
virtual function.

1. Write a C++ program declare a class 1. Write a C++ program declare a class
“polygon” having data members width “Human” having pure virtual function
and height() as a member function. Create
height and area() as class Boy to inherit class Human.
a member function. Create class
Triangle to inherit class polygon with
the help of virtual function.

1. Write a C++ program declare a class 1. Write a C++ program declare a class
“Fruit” taste() as “Shape” having data members width
a member function. Create class Mango and
to inherit class Fruit with the help of height and pure virtual function area()
virtual function. as
a member function. Create class
Rectangle to inherit class Shape.
1. Write a C++ program declare a class 1. Write a C++ program declare a class
“Shape” having data members width “Fruit” pure virtual function taste() as
and a member function. Create class Mango
height and area() as to inherit class Fruit.
a member function. Create class
Rectangle to inherit class Shape virtual
function.
Week 13 : Set 14
Exp 23 Exp 24
1. Write a program in C++ in which 1. Write a C++ program to use
open a file data.txt in read and write sequential
mode and display the content on input and output operations on data.txt
output screen using open() function . file .

1. Write a program in C++ in which 1. Write a C++ Program to use


open a file simple.txt in append mode sequential
and display the content on output input and output operators like gets
screen using open() function . and puts on circle.txt file.

1. Write a program in C++ in which 1. Write a C++ program to use


open a file sample.txt in read and write sequential
mode and display the content input and output operators like getline
on output screen using constructor. on second.txt file.

1. Write a program in C++ in which 1. Write a C++ Program toto use


open a file first.txt in append mode sequential
and display the content on output input and output operators like get and
screen using constructor. put on video.txt file.
1. Write a program in C++ in which 1. Write a C++ program to use
open a file test.txt in truncate mode sequential
and and display the content on output input and output operations on
screen using open() function . function.txt file.
Week 14 : Set 15
Exp 25 Exp 26
1. Write a C++ program to Read 1. Write C++ Program to write and read
Content from data.txt file and Write it objects in binary file using write () and
into info.txt File. read () methods.

1. Write a C++ Program to Copy the 1. Write a C++ program to copy entire
Contents of circle.txt file into area.txt content of one binary file at a time to
file. another
file using read () and write ().

1. Write a C++ program to Read 1. Write C++ Program to write in


Content from first.txt file and Write it demo.txt file and read data from
into second.txt file. demo.txt binary file using write () and
read () methods.

1. Write a C++ Program to Copy the 1. Write C++ Program to write in


Contents of sound.txt file into video.txt abc.txt file and read data from abc.txt
file. binary file using write () and read ()
methods.
1. Write a C++ program to Read 1. Write C++ Program to write in
Content from sample.txt file and Write data.txt file and read data from data.txt
it into function.txt file. binary file using write () and read ()
methods.
VIDYALANKAR POLYTECHNIC

THIRD SEM COMPUTER ENGINEERING (CO3K)


Sr. No Roll ID Student Name Grp no
1
2
G1
3
4
5
6
G2
7
8

10
G3
11
12

13
14
G4
15
16
17
18
G5
19
20
VIDYALANKAR POLYTECHNIC

HIRD SEM COMPUTER ENGINEERING (CO3K)


Application 1 Application 2
Develop Student Grading System. Accept Develop Quiz Management System. Quiz should
student data and marks for 5 subjects for 5 accept student credentials and contain 10 MCQ type
students. Calculate thepercentage and questions.Determine the final result. Save the result in
finalize grade awarded to the student. file along with student credentials.
Write the records in to file.

Develop advanced calculator for the Develop Hotel Management Application. It should
following function: Binary to Decimal, accept room reservation for 10 rooms. Find number of
Decimal to Binary etc.. emptyrooms. Display relevant information and write
maximum 5 records into file.

Develop Employee Management System Develop Games USing C++ like Tic-Tac-Toe
using Inheritance. Collect following game,Snake Game
information from
user:Employee_ID ,Employee_Name,
Basic_Salary, Leave taken in the month
Calculate Net Salary assuming
applicabledeductions and display. Write
maximum 5 records into file.
Develop application in C++ to Control Toys Develop application in C++ to Control Drone

Develop application in C++ for Develop application for Currency Controller


Minesweeper Game

You might also like