Vishnu
Vishnu
MAHAVIR
Object Oriented Programming- Practical (2030107302)
UNIVERSITY
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
int choice;
float area;
cout << "Choose the shape to calculate the area:\n";
cout << "1. Circle\n";
cout << "2. Triangle\n";
cout << "3. Square\n";
cout << "Enter your choice (1-3): ";
cin >> choice;
switch (choice)
{
case 1:
{
float radius;
cout << "Enter the radius of the circle: ";
cin>> radius;
area = M_PI * radius * radius; // Area = π * r^2
cout<< "The area of the circle is: " << area << endl;
break;
}
case 2:
{
float base, height;
cout << "Enter the base of the triangle: ";
cin>> base;
cout << "Enter the height of the triangle: ";
cin >> height;
area = 0.5 * base * height; // Area = 0.5 * base * height
cout << "The area of the triangle is: " << area << endl;
break;
}
case 3:
{
float side;
cout << "Enter the side length of the square: ";
cin >> side;
area = side * side; // Area = side^2
cout << "The area of the square is: " << area << endl;
break;}
default:
BHAGWAN MAHAVIR POLYTECHNIC
4
I.T. ENGINEERING
BHAGWAN
MAHAVIR
Object Oriented Programming- Practical (2030107302)
UNIVERSITY
cout << "Invalid choice! Please enter a valid option (1-3).\n";
}
return 0;
}
Input-Output:
Program Created By Vishnu Rawal [En_No.: 2327010701136]
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Aim 2.1.1: Write a program to display the variable value before addition and after addition using
reference variable.
Source Code:
// Write a program to display the variable value before addition and after addition using reference variable.
#include <iostream>
using namespace std;
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Aim 3.1.1: Write a program which takes string as input and read its character and display it
using getline and write functions.
Source Code:
//Write a program which takes string as input and read its character and display it using
getline and write functions.
#include<iostream>
#include<cstring>
#include <iomanip>
using namespace std;
int main()
{
cout<<"Program Created By Vishnu Rawal [En_No.: 2327010701136]"<<endl<<endl;
char str[20];
int i,n;
cout<<"Enter some String"<<endl; cin.getline(str,20);
n = 15;
cout<<n<<endl;
for( i = 0 ; i < n ; i++)
{
cout.write(str,i); cout<<endl;
}
return 0;
}
Input-Output:
H
He
Hel
Hell
Hello
Hello
Hello W
Hello Wo
Hello Wor
Hello Worl
Hello World
Hello World
=== Code Execution Successful ===
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
string name;
int age;
// Input
cout << "Enter your name: ";
getline(cin, name);
cout << "Enter your age: ";
cin >> age;
// Output formatted
cout << string(20, '-') << "\n"; // Print a line of dashes for better output structure
cout << left << setw(10) << "Name:" << name << "\n";
cout << left << setw(10) << "Age:" << age << "\n";
cout << string(20, '*') << "\n"; // Print a line of asterisks for separation
return 0;
}
Input-Output:
Program Created By Vishnu Rawal [En_No.: 2327010701136]
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Aim 4.1.1: Write a program to swap two numbers value using “ Call by Reference”
Source Code:
//Write a program to swap the value of two numbers using call by reference
#include <iostream>
using namespace std;
// Function to swap two numbers using reference variables
void Call_by_Reference (int &a, int &b) {
int temp = a;
a = b;
b = temp;
}
void Call_by_value (int a, int b) { int temp = a;
a = b;
b = temp;
}
int main ()
{
cout<<"Program Created By Vishnu Rawal [En_No.: 2327010701136]"<<endl<<endl;
Call_by_value(num1, num2);
// Display numbers after swapping
cout << "\nUsing Call By Value:\n";
cout << "Number 1: " << num1 << endl; cout << "Number 2: " << num2 << endl;
return 0;
}
Input-output:
Before swapping:
Number 1: 10
Number 2: 20
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Number 1:10
Number 2:20
After manipulation:
Number 1:30
Number 2:10
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Source Code:
// Create Student (student name and age/enrollment number),Employee(Employee Name,Job
Title/age/Department),Shape(Rectange/Circle/Square ,Area caluclation) classes with given attribute
and test.
#include <iostream>
#include <string>
using namespace std;
class student {
int rollNo;
string name;
public:
void getDetails() {
cout << "Student Information:" << endl;
cout << "Enter Name: ";
cin.ignore(); // Clear input buffer before using getline
getline(cin, name); // Use getline to allow spaces in the name
cout << "Enter Roll Number: ";
cin >> rollNo;
}
void displayDetails() {
cout << "\nStudent Details:" << endl;
cout << "Roll Number: " << rollNo << endl;
cout << "Name: " << name << endl;
}
};
class employee {
string name;
string department;
string role;
public:
void getDetailsemp() {
cout << "\nEmployee Information:" << endl;
cout << "Enter Name: ";
cin.ignore(); // Clear input buffer before using getline
getline(cin, name); // Use getline to allow spaces in the name
cout << "Enter Department: ";
getline(cin, department); // Use getline to allow spaces in department
cout << "Enter Job Type: ";
getline(cin, role); // Use getline to allow spaces in job type
}
void displayDetailsshap() {
cout << "\nShape Details:" << endl;
cout << "The area of the triangle is: " << area << endl;
}
};
int main() {
employee e1;
e1.getDetailsemp();
e1.displayDetailsemp();
shap t1;
t1.getDetailsshap();
t1.displayDetailsshap();
return 0;
}
Student Information:
Enter Name: Vishnu rawal
Enter Roll Number: 136
Student Details:
Roll Number: 136
Name: ishnu rawal
Employee Information:
Enter Name: Vishnu rawal
Enter Department: IT
Enter Job Type: Software Engineer
Employee Details:
Name: Vishnu rawal
Department: IT
Job Type: Software Engineer
Triangle Information:
Enter Base of Triangle: 5
Enter Height of Triangle: 6
Shape Details:
The area of the triangle is: 15
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Aim 6.1.1: Write a program to create Vehicle class and create three different types of vehicles entries
which should have details like color, model, and transmission type.
Source Code:
// Write a program to create Vehicle class and create three different types of vehicles entries which
should have details like color, model, and transmission type.
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
// Define a Vehicle class
class Vehicle {
public:
string name; string color; double price;
// Function to display vehicle details
void display() {
cout << "Name: " << name << endl;
cout << "Color: " << color << endl;
cout << "Price: "<<fixed << setprecision(2) << price << endl;
cout << "----------------" << endl;
}
};
int main() {
cout<<"Program Created By Vishnu Rawal [En_No.: 2327010701136]"<<endl<<endl;
int numVehicles = 3; // Number of vehicles
Vehicle vehicles[numVehicles]; // Array of Vehicle objects
// Input details for each vehicle
for (int i = 0; i < numVehicles; i++) {
cout << "Enter the Name of vehicle " << (i + 1) << ": ";
Vehicle Details:
Vehicle 1:
Name: Swift
Color: black
Price: 200000.00
----------------
Vehicle 2:
Name: Creta
Color: red
Price: 300000.00
----------------
Vehicle 3:
Name: Glanza
Color: White
Price: 500000.00
----------------
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Aim 7.1.1: Write a program to add the numbers of two objects by passing object as argument and
return the sum as output in third object.
Source Code:
// Write a program to add the numbers of two objects by passing object as argument and return the sum as
output in third object.
#include <iostream>
using namespace std;
class Student
{
public:
int mark;
Student addAndReturn(Student a) { Student temp;
temp.mark = mark + a.mark; return temp;
}
};
int main() {
result = mark1.addAndReturn(mark2);
cout << endl << "After using addAndReturn() (returning an object): " << endl;
Initial values:
Value of object 1: 10
Value of object 2: 20
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Aim 8.1.1: Write a program to add two complex numbers using + operator overloading.
Source Code:
// Write a program to add two complex numbers using + operator overloading.
#include<iostream>
using namespace std;
class Complex {
private:
int real, imag;
public:
Complex(int r = 0, int i = 0)
{
real = r;
imag = i;
}
Complex operator + (Complex const &obj)
{
Complex res;
res.real = real + obj.real;
res.imag = imag + obj.imag;
return res;
}
void print() {
cout << real << " + " << imag << "i" << endl; }
};
int main() {
6 + 17i
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Aim 9.1.1: Write a program to print the Global Variables value using Scope Resolution (::) operator.
Source Code:
//Write a program to print the Global Variables value using Scope Resolution (::) operator
#include <iostream>
using namespace std;
int value = 100;
int main()
{
cout<<"Program Created By Vishnu Rawal [En_No.: 2327010701136]"<<endl<<endl;
int value = 50;
cout << "Local value: " << value << endl;
cout << "Global value: " << ::value << endl;
return 0;
}
Input-Ouput:
Program Created By Vishnu Rawal [En_No.: 2327010701136]
Local value: 50
Global value: 100
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Aim 10.1.1: Write a program to set Person name and age by using Default Constructor.
Source Code:
// Write a program to set person name and age by using default constructor.
#include<iostream>
using namespace std;
class Person
{
private:
string name; int age;
public:
Person(){
name = "Vishnu";
age = 17;
}
void getdetail(){
cout<<"Name:"<<name<<endl;
cout<<"Age:"<<age;
}
};
int main(){
cout<<"Program Created By Vishnu Rawal [En_No.: 2327010701136]"<<endl<<endl;
Person person_1,person_2;
cout<<"Default Constructor:"<<endl;
person_1.getdetail();
return 0;
}
Input-Output:
Program Created By Vishnu Rawal [En_No.: 2327010701136]
Default Constructor:
Name:Vishnu
Age:17
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
Source Code:
// Write a program to set person name and age by using Parameterized constructor.
#include<iostream>
using namespace std;
class Person
{
private:
string name;
int age; public:
Person(string person_name,
int person_age){
name = person_name;
age = person_age;
}
void getdetail(){
cout<<"Name:"<<name<<endl;
cout<<"Age:"<<age;
}
};
int main(){
cout<<"Program Created By Vishnu Rawal [En_No.: 2327010701136]"<<endl<<endl;
Person person_1("Vishnu",17);
cout<<endl<<"Parameterize constructor:"<<endl;
person_1.getdetail();
return 0;
}
Input-Output:
Program Created By Vishnu Rawal [En_No.: 2327010701136]
Parameterize constructor:
Name:Vishnu
Age:17
Parameterized constructor:
Name: Vishnu
Age: 17
Copy Constructor:
Name: Vishnu
Age: 17
Total Marks
Criteria Exceptional Satisfactory Developing Limited
Marks Obtaine
d
Accurately 1-2 errors / 3-5 errors/ More than 5
Accuracy 3 done mistake mistake errors
(3) (2) (1) (1)
Fully under Partially Partially
Understand
stood and understood understood
Understanding but cannot
3 explain and can and cannot
& Explanation explain
perfectly explain explain
(2)
(3) (1) (1)
Watched other
Present but
Performed students
Performed not
Practical performing
Practical participate
Engagement 2 with other practical but
him/her self in
help not tried him/
(2) performance
(1) her self
(0.5)
(0.5)
Document is Missing
Documented Poor writing,
proper, but output.
properly, no missing
Documentation 1 presentation Improper
error output
is average documentation
(1) (0.25)
(0.5) (0.25)
Complete Complete Work
Submit after 2
within a within two submits after
Time 1 weeks
week weeks 3 weeks.
(0.25)
(1) (0.5) (0.25)
Total
class Person {
private:
string name;
int age;
public:
Person(){
cout<<"Default Constructor:"<<endl;
}
// Parameterized constructor
Person(string person_name, int person_age) {
name = person_name;
age = person_age;
}
// Destructor
void getdetail() {
cout << "Name: " << name << endl;
cout << "Age: " << age << endl;
}
~Person() {
cout<< "Object is destroyed."<<endl;
}
};
int main()
{
Parameterized constructor:
Default Constructor:
Name: Vishnu
Age: 17
Object is destroyed.
Object is destroyed.