CONSTRUCTOR
Submitted in fulfillment of requirements
of micro-project
Object Oriented Programming
By
“Aadie Gupta”
“Darshana Malusare”
“Gaurangi Madankar”
ROLL NO: - 55
56
57
ENROLLMENT NO: - 2209640226
2209640227
2209640228
SUBJECT INCHARGE
Mrs. Jyoti Shinde
Computer Engineering Department
Academic Year 2023-2024
CERTIFICATE
This is to certify that the microproject
“CONSTRUCTOR”
is done by
“Aadie Gupta”
“Darshana Malusare”
“Gaurangi Madankar”
is submitted for
“Object Oriented Programming”
for
the diploma in Computer Engineering to the
Maharashtra State Board of Technology Education, Mumbai
(Autonomous) (ISO-9001-2008) (ISO/IEC 27001:2013)
___________ ____________
Subject In charge Head of Department
(Mrs. Jyoti Shinde) (Mrs. Smita Kuldiwar)
CONSTRUCTOR
Submitted in fulfillment of requirements
of micro-project
Object Oriented Programming
By
PROCESS AND INDIVIDUAL TOTAL
ROLL NAME ENROLLMENT PRODUCT PRESENTATION/ (10 marks)
NO NO ASSESMENT (6 WORK (4 marks)
marks)
55 AADIE 2209640226
GUPTA
56 DARSHANA 2209640227
MALUSARE
57 GAURANGI 2209640228
MADANKAR
SUBJECT INCHARGE
Mrs. Jyoti Shinde
Computer Engineering Department
Academic Year 2023-2024
COMPUTER ENGINEERING DEPARTMENT
VISION AND MISSION OF THE PROGRAMME
VISION
To contribute to society through excellence in scientific & knowledgeable based
education of computer science professionals.
MISSION
M1: To transform students into technically components, socially responsible & ethical
computer science professionals.
M2: To promote a creative teaching-learning process that will strive for academic
excellence in the field of computer engineering.
M3: To enhance the technical expertise of students through workshop & industry-
institute interaction.
COMPUTER ENGINEERING DEPARTMENT
PROGRAMME OUTCOMES
PO1: Basic and Discipline specific knowledge: Apply knowledge of basic
mathematics, science and engineering fundamentals and engineering specialization to
solve the engineering problems.
PO2: Problem analysis: Identify and analyse well-defined engineering problems
using codified standard methods.
PO3: Design/ Development of solutions: Design solutions for well-defined technical
problems and assist with the design of systems components or processes to meet
specified needs.
PO4: Engineering Tools, Experimentation and Testing: Apply modern engineering
tools and appropriate technique to conduct standard tests and measurements.
PO5: Engineering practices for society, sustainability and environment: Apply
appropriate technology in context of society, sustainability, environment and ethical
practices
PO6: Project Management: Use engineering management principles individually, as
a team member or a leader to manage projects and effectively communicate about
well-defined engineering activities.
PO7: Life-long learning: Ability to analyse individual needs and engage in updating
in the context of technological changes.
COMPUTER ENGINEERING DEPARTMENT
PROGRAMME EDUCATIONAL OBJECTIVES
PEO1: Provide socially responsible, environment friendly solutions to
Computer engineering related broad-based problems adapting professional
ethics.
PEO2: Adapt state-of-the-art Computer engineering broad-based technologies
to work in multidisciplinary work environments.
PEO3: Solve broad-based problems individually and as a team member
communicating effectively in the world of work.
PROGRAMME SPECIFIC OUTCOMES
PSO1: Computer Software and Hardware Usage: Use state-of-the-art
technologies for operation and application of computer software and hardware.
PSO2: Computer Engineering Maintenance: Maintain computer engineering
related software and hardware systems.
CONSTRUCTOR
Aim
Replacing ‘cout’ by names using constructor.
Course Outcomes
Successfully can write/ compile/ debug/ execute simple C++ program using constructors.
Proposed Methodology
First, Search the topic for which you want to make a project, and then propose it to
the Subject In charge.
After finalizing the topic, start gathering the information about your project.
Recheck the program with the subject in charge.
Now, it’s time to make a report of your Selected Project.
Action Plan
Sr. Detail of activity Plan Start Date Plan Finish Date
No.
1. Searching of Topic 25-09-2023 27-09-2023
2. Gathering Information 28-09-2023 30-09-2023
3. Report Making 11-10-2023 14-10-2023
Subject In-Charge
(Mrs. Jyoti Shinde)
CONSTRUCTOR
Rationale
Constructors contribute to the principle of encapsulation by allowing the bundling of data
(attributes) and methods (functions) within a class. They abstract away the details of how an
object is initialized, promoting a clean interface between the object and the outside world.
Constructors can be used to allocate resources or perform necessary setup operations,
ensuring that an object is ready for use. They also play a role in resource management, as
destructors (another special member function) can be used for releasing resources when an
object goes out of scope.
Constructors are a crucial aspect of C++ programming, facilitating the creation and proper
initialization of objects. They align with the principles of object-oriented design, such as
encapsulation, and contribute to the overall clarity and reliability of C++ code.
Literature
Constructors are special member functions which performs initialization of every object. The
Compiler call the Constructor whenever the object is created. Constructors initialize values to
variables after storage is allocated to the object.
There are three types of constructors:
o Default Constructor
o Parameterized Constructor
o Copy Constructor
Declaring constructor function:
Syntax:
class className
{
//other members declaration
public:
className (list of parameters)
{
//body of constructor function
}
//other members declaration
};
Constructor Overloading:
Just like other member functions, constructors can also be overloaded. In fact, when you have
both default and parameterized (more than one) constructors defined in your class you are
having Overloaded Constructors, one which no parameters and other with parameter.
Declaring overloaded constructor functions:
Syntax:
class className
{
public:
className () { //Default constructor
//body of default constructor function
}
className (list of parameters) { //Parametrized constructor
//body of parametrized constructor function
}
className (className &obj) { //Copy constructor
//body of copy constructor function
}
};
Actual Methodology Followed
Topi Work Done Data Work Done By
c
1. Searching of topic (Develop a program for Darshana Malusare
moving ball)
2. Gathering Information (Rationale, Aim, Applications, Gaurangi Madankar /
etc.) Darshana Malusare
3. Report Making Finalization of report Gaurangi Madankar
Resources Required
Sr. No. Name of Resources Specification Qty. Remark
1. Computer System Intel i3, 4GB RAM or 1 -
above
2. Reference Book OOP Nirali Publication 1 -
3. Software Turbo C++ - -
Source Code
DEFAULT CONSTRUCTOR
#include<iostream.h>
#include<conio.h>
class circle
{
private:
float r, area, circum, vol;
public:
circle ();
void compute ()
{
area=3.14*r*r;
circum=2*3.14*r;
vol= (4/3) *3.14*r*r*r;
}
void display ()
{
cout<<"\nArea = "<<area;
cout<<"\nCircumference = "<<circum;
cout<<"\nVolume = "<<vol;
}
};
circle :: circle ()
{
cout<<"\nEnter radius: ";
cin>>r;
}
void main ()
{
clrscr();
circle c;
c.compute();
c.display();
getch();
}
Output
PARAMETRIZED CONSTRUCTOR
#include<iostream.h>
#include<conio.h>
class circle
{
private:
float r, area, circum, vol;
public:
circle(float x);
void compute()
{
area= 3.14*r*r;
circum= 2*3.14*r;
vol= (4/3) *3.14*r*r*r;
}
void display()
{
cout<<"\nArea = "<<area;
cout<<"\nCircumference = "<<circum;
cout<<"\nVolume = "<<vol;
}
};
circle :: circle(float x)
{
r=x;
}
void main()
{
float radius;
clrscr();
cout<<"\nEnter radius: ";
cin>>radius;
circle c(radius);
c.compute();
c.display();
getch();
}
Output
COPY CONSTRUCTOR
#include<iostream.h>
#include<conio.h>
#include<math.h>
class Circle {
private:
float radius;
public:
// Default constructor
Circle() {
radius = 0.0;
}
Circle(float r) {
radius = r;
}
Circle(const Circle& other) {
radius = other.radius;
}
float calculateArea() {
return 3.14 * radius * radius;
}
float calculateCircumference() {
return 2 * 3.14 * radius;
}
float calculateVolume() {
return (4.0 / 3.0) * 3.14 * pow(radius, 3);
}
void display()
{
cout << "Radius: " << radius << endl;
cout << "Area: " << calculateArea() << endl;
cout << "Circumference: " << calculateCircumference() << endl;
cout << "Volume: " << calculateVolume() << endl;
}
};
int main()
{
clrscr();
float userRadius;
cout << "Enter the radius of the circle: ";
cin >> userRadius;
Circle circle1(userRadius);
Circle circle2 = circle1;
cout << "\nCircle 1:\n";
circle1.display();
cout << "\nCircle 2 (copied from Circle 1 using copy constructor):\n";
circle2.display();
getch();
}
Output
Skill Developed
1. Able to develop Constructor programs.
2. Able to analyse and fic the errors.
3. Able to debug the program.
Applications
Can be used in college and school level programs.
Subject In-charge
(Mrs. Jyoti Shinde)