CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.1 Write a program to take a number from user using a member function and display the
number using a friend function.
CODE:
#include <iostream>
using namespace std;
class Number {
int num;
public:
void input() {
cout << "Enter a number: ";
cin >> num;
friend void display(Number);
};
void display(Number n) {
cout << "The number is: " << n.num << endl;
int main() {
Number n;
n.input();
display(n);
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.2Write a program to input price of two products in a member function and display the total bill
amount using a friend function.
CODE:
#include <iostream>
using namespace std;
class Product {
float price1, price2;
public:
void input() {
cout << "Enter price of product 1: ";
cin >> price1;
cout << "Enter price of product 2: ";
cin >> price2;
friend void displayTotal(Product);
};
void displayTotal(Product p) {
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
float total = p.price1 + p.price2;
cout << "Total bill amount: " << total << endl;
int main() {
Product p;
p.input();
displayTotal(p);
return 0;
OUTPUT:
QUE.3 Write a program to input three numbers in a member function and display the maximum
number using a friend function
CODE:
#include <iostream>
using namespace std;
class Numbers {
int a, b, c;
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
public:
void input() {
cout << "Enter three numbers: ";
cin >> a >> b >> c;
friend void displayMax(Numbers);
};
void displayMax(Numbers n) {
int maxNum = n.a;
if (n.b > maxNum) maxNum = n.b;
if (n.c > maxNum) maxNum = n.c;
cout << "The maximum number is: " << maxNum << endl;
int main() {
Numbers n;
n.input();
displayMax(n);
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.4 Write a program to calculate Simple Interest using a friend function. The input must be taken
using a member function defined outside the class.
CODE:
#include <iostream>
using namespace std;
class Interest {
float principal, rate, time;
public:
void input() {
cout << "Enter principal amount: ";
cin >> principal;
cout << "Enter rate of interest: ";
cin >> rate;
cout << "Enter time (in years): ";
cin >> time;
friend float calculateSI(Interest);
};
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
float calculateSI(Interest i) {
return (i.principal * i.rate * i.time) / 100;
int main() {
Interest i;
i.input();
cout << "Simple Interest: " << calculateSI(i) << endl;
return 0;
OUTPUT:
QUE.5 Write a program for Single Inheritance. Create a base class that accepts one number. Create
a derived class that displays this number using a member function
CODE:
#include <iostream>
using namespace std;
class Base {
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
protected:
int number;
public:
void input() {
cout << "Enter a number: ";
cin >> number;
};
class Derived : public Base {
public:
void display() {
cout << "The number is: " << number << endl;
};
int main() {
Derived d;
d.input();
d.display();
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.6Write a program for Multi-Level Inheritance. Define a class Parent to accept Father_name and
Mother_name. Create a subclass Child1 with a data member Chname1. Create another separate
class Child2 with ChName2, Father_Name, and Mother_Name. Further, derive a subclass Son from
both Child1 and Child2. Further, derive a subclass Son from both Child1 and Child2 with a data
member Son_Name. Accept input for all attributes and display the information using inheritance.
CODE:
#include<iostream>
using namespace std;
class parent
protected:
char fname[20];
char mname[20];
public:
void getdata()
cout<<"\n Enter father name :";
cin>>fname;
cout<<"\n Enter mother name :";
cin>>mname;
void putdata()
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
cout<<"\n Father name :"<<fname;
cout<<"\n mother name :"<<mname;
};
class child1 : public parent
protected:
char cname1[20];
public:
void getdata()
parent :: getdata();
cout<<"\n Enter child-1 name:";
cin>>cname1;
void putdata()
parent :: putdata();
cout<<"\n child-1 name:"<<cname1;
};
class child2 : public parent
protected:
char cname2[20];
public:
void getdata(
{
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
parent::getdata();
cout<<"\n Enter child-2 name :";
cin>>cname2;
void putdata()
parent :: putdata();
cout<<"\n child-2 name:"<<cname2;
};
class son : public child1,public child2
protected:
char sname[20];
public:
void getdata()
child1 :: getdata();
child2 :: getdata();
cout<<"\n Enter son name :";
cin>>sname;
void putdata()
child1 :: putdata();
child2 :: putdata();
cout<<"\n son name :"<<sname;
};
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
int main()
son s;
s.getdata();
s.putdata();
return 0;
}OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.7 Write a program for Single Inheritance. Define a class Student to accept RollNo and
Student_Name. Create a subclass Marks to store marks for two subjects Sub1 and Sub2. Accept
input for all attributes and display the details using inheritance.
CODE:
#include <iostream>
using namespace std;
class Student {
protected:
int rollNo;
string studentName;
public:
void input() {
cout << "Enter Roll No: ";
cin >> rollNo;
cout << "Enter Student Name: ";
cin >> studentName;
};
class Marks : public Student {
protected:
float sub1, sub2;
public:
void inputMarks() {
input();
cout << "Enter marks for Subject 1: ";
cin >> sub1;
cout << "Enter marks for Subject 2: ";
cin >> sub2;
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
void display() {
cout << "Roll No: " << rollNo << endl;
cout << "Student Name: " << studentName << endl;
cout << "Marks in Subject 1: " << sub1 << endl;
cout << "Marks in Subject 2: " << sub2 << endl;
};
int main() {
Marks m;
m.inputMarks();
m.display();
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.8 Write a program for Multi-Level Inheritance. Define a class Student to accept RollNo and
Student_Name. Create a subclass Marks to store marks for two subjects Sub1 and Sub2. Further,
derive a subclass Result from Marks to calculate the Total and percentage. Accept input for all
attributes and display the details using inheritanc
CODE:
#include <iostream>
using namespace std;
class Student {
protected:
int rollNo;
string studentName;
public:
void input() {
cout << "Enter Roll No: ";
cin >> rollNo;
cout << "Enter Student Name: ";
cin >> studentName;
};
class Marks : public Student {
protected:
float sub1, sub2;
public:
void inputMarks() {
input();
cout << "Enter marks for Subject 1: ";
cin >> sub1;
cout << "Enter marks for Subject 2: ";
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
cin >> sub2;
};
class Result : public Marks {
public:
void display() {
float total = sub1 + sub2;
float percentage = (total / 200) * 100;
cout << "Roll No: " << rollNo << endl;
cout << "Student Name: " << studentName << endl;
cout << "Total Marks: " << total << endl;
cout << "Percentage: " << percentage << "%" << endl;
};
int main() {
Result r;
r.inputMarks();
r.display();
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.9 Write a program for Multiple Inheritance. Define a class Education to accept Degree and
Class. Define another parent class Language with a data member Lang. Derive three subclasses:
Sales_Representative (includes Age,) Medical_Representative (includes Age and Experience) and
Worker. Accept input for all attributes and display the details using inheritance.
CODE:
#include <iostream>
using namespace std;
class Education {
protected:
string degree;
string className;
public:
void inputEducation() {
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
cout << "Enter Degree: ";
cin >> degree;
cout << "Enter Class: ";
cin >> className;
};
class Language {
protected:
string lang;
public:
void inputLanguage() {
cout << "Enter Language: ";
cin >> lang;
};
class SalesRepresentative : public Education, public Language {
protected:
int age;
public:
void inputSalesRep() {
inputEducation();
inputLanguage();
cout << "Enter Age: ";
cin >> age;
void display() {
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
cout << "Degree: " << degree << endl;
cout << "Class: " << className << endl;
cout << "Language: " << lang << endl;
cout << "Age: " << age << endl;
};
int main() {
SalesRepresentative sr;
sr.inputSalesRep();
sr.display();
return 0;
OUTPUT:
QUE.10 Write a program for Hierarchical Inheritance. Define a class Employee to accept Code and
EName. Create two subclasses: Teaching (includes Department and Publication) and Non-Teaching
(includes Designation and extra_holiday). Accept input for all attributes and display the details using
inheritanc
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
CODE:
#include <iostream>
using namespace std;
class Employee {
protected:
int code;
string eName;
public:
void input() {
cout << "Enter Employee Code: ";
cin >> code;
cout << "Enter Employee Name: ";
cin >> eName;
};
class Teaching : public Employee {
protected:
string department;
string publication;
public:
void inputTeaching() {
input(); // Call the base class input function
cout << "Enter Department: ";
cin >> department;
cout << "Enter Publication: ";
cin >> publication;
}
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
void displayTeaching() {
cout << "\n--- Teaching Employee Details ---" << endl;
cout << "Employee Code: " << code << endl;
cout << "Employee Name: " << eName << endl;
cout << "Department: " << department << endl;
cout << "Publication: " << publication << endl;
};
class NonTeaching : public Employee {
protected:
string designation;
int extraHolidays;
public:
void inputNonTeaching() {
input(); // Call the base class input function
cout << "Enter Designation: ";
cin >> designation;
cout << "Enter Extra Holidays: ";
cin >> extraHolidays;
void displayNonTeaching() {
cout << "\n--- Non-Teaching Employee Details ---" << endl;
cout << "Employee Code: " << code << endl;
cout << "Employee Name: " << eName << endl;
cout << "Designation: " << designation << endl;
cout << "Extra Holidays: " << extraHolidays << endl;
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
};
int main() {
Teaching t;
NonTeaching nt;
cout << "Input Teaching Employee Details:" << endl;
t.inputTeaching();
t.displayTeaching();
cout << "\nInput Non-Teaching Employee Details:" << endl;
nt.inputNonTeaching();
nt.displayNonTeaching();
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.11 Write a program for Arithmetic Operations using Base and Derived Class. Define a base class
that accepts one number. Create a derived class that accepts another number. Perform basic
arithmetic operations (+ , - , * , /) using a member function in a derived class.
CODE:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
#include <iostream>
using namespace std;
class Base {
protected:
float number1;
public:
Base(float num) : number1(num) {}
};
class Derived : public Base {
private:
float number2;
public:
Derived(float num1, float num2) : Base(num1), number2(num2) {}
void arithmeticOperations() {
cout << "Addition: " << number1 + number2 << ;
cout << "Subtraction: " << number1 - number2 << ;
cout << "Multiplication: " << number1 * number2 << ;
if (number2 != 0)
cout << "Division: " << number1 / number2 << ;
else
cout << "Division by zero" << ;
};
int main() {
float num1, num2;
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
cout << "Enter first number: ";
cin >> num1;
cout << "Enter second number: ";
cin >> num2;
Derived calc(num1, num2);
calc.arithmeticOperations();
return 0;
OUTPUT:
QUE.12 Write a program to initialize two data members i.e. height and width by using default
constructor in a base class “Shape” and Calculate area of Rectangle by using a member function in a
derived class “Rectangle”.
CODE:
#include <iostream>
using namespace std;
class Shape {
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
protected:
float height;
float width;
public:
Shape() : height(9), width(3) {} // Default constructor
};
class Rectangle : public Shape {
public:
float area() {
return height * width;
};
int main() {
Rectangle rect;
cout << "Area of Rectangle: " << rect.area() << ;
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.13 Write a program to enter Employee_ID, Employee_Name in a Base class by using member
function and enter Employee_Department and Number_of_ Leaves applied in a derived class. Show
the data using a member function of a derived class (member function definition must be outside
the class).
CODE:
#include <iostream>
using namespace std;
class Employee {
protected:
int Employee_ID;
string Employee_Name;
public:
void input() {
cout << "Enter Employee ID: ";
cin >> Employee_ID;
cout << "Enter Employee Name: ";
cin >> Employee_Name;
};
class DerivedEmployee : public Employee {
private:
string Employee_Department;
int Number_of_Leaves;
public:
void inputDetails() {
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
input();
cout << "Enter Employee Department: ";
cin >> Employee_Department;
cout << "Enter Number of Leaves: ";
cin >> Number_of_Leaves;
void display() {
cout << "Employee ID: " << Employee_ID << ;
cout << "Employee Name: " << Employee_Name << ;
cout << "Employee Department: " << Employee_Department << ;
cout << "Number of Leaves: " << Number_of_Leaves << ;
};
int main() {
DerivedEmployee emp;
emp.inputDetails();
emp.display();
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.14 Write a program to input one number in a class “A” and another number in a class “B”. Now,
make summation of these two numbers in a derived class “C”.
CODE:
#include <iostream>
using namespace std;
class A {
protected:
int num1;
public:
void input() {
cout << "Enter first number: ";
cin >> num1;
}
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
};
class B {
protected:
int num2;
public:
void input() {
cout << "Enter second number: ";
cin >> num2;
};
class C : public A, public B {
public:
void sum() {
cout << "Sum: " << num1 + num2 << ;
};
int main() {
C obj;
obj.A::input();
obj.B::input();
obj.sum();
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.15 Write a program for Multiple Inheritance. Define a base class “Father” to accept
Father_Salary. Define another base class “Mother” to accept Mother_Salary. Create a derived class
Income that calculates Total_Salary.
CODE:
#include <iostream>
using namespace std;
class Father {
protected:
float Father_Salary;
public:
void inputFatherSalary() {
cout << "Enter Father's Salary: ";
cin >> Father_Salary;
}
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
};
class Mother {
protected:
float Mother_Salary;
public:
void inputMotherSalary() {
cout << "Enter Mother's Salary: ";
cin >> Mother_Salary;
};
class Income : public Father, public Mother {
public:
void calculateTotalSalary() {
float Total_Salary = Father_Salary + Mother_Salary;
cout << "Total Salary: " << Total_Salary << ;
};
int main() {
Income familyIncome;
familyIncome.inputFatherSalary();
familyIncome.inputMotherSalary();
familyIncome.calculateTotalSalary();
return 0;
}
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
OUTPUT:
QUE.16 Write a program for Student’s Marks, Total, Percentage and Grade Calculation. Define a
base class Internal to input IOOP, FOS, FCBP, BME, FCN internal marks. Define another base class
External to input IOOP, FOS, FCBP, BME, FCN external marks. Create a derived class Final to calculate
Total_Marks, Percentage and Grade (i.e. Distinction, First, Second, Pass, and Fail)
CODE:
#include <iostream>
using namespace std;
class Internal {
protected:
float IOOP, FOS, FCBP, BME, FCN;
public:
void inputInternalMarks() {
cout << "Enter Internal Marks (IOOP, FOS, FCBP, BME, FCN): ";
cin >> IOOP >> FOS >> FCBP >> BME >> FCN;
}
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
};
class External {
protected:
float IOOP, FOS, FCBP, BME, FCN;
public:
void inputExternalMarks() {
cout << "Enter External Marks (IOOP, FOS, FCBP, BME, FCN): ";
cin >> IOOP >> FOS >> FCBP >> BME >> FCN;
};
class Final : public Internal, public External {
public:
void calculateResults() {
float totalMarks = IOOP + FOS + FCBP + BME + FCN;
float percentage = (totalMarks / 500) * 100;
string grade;
if (percentage >= 75) grade = "Distinction";
else if (percentage >= 60) grade = "First";
else if (percentage >= 50) grade = "Second";
else if (percentage >= 40) grade = "Pass";
else grade = "Fail";
cout << "Total Marks: " << totalMarks << ;
cout << "Percentage: " << percentage << "%" << ;
cout << "Grade: " << grade << ;
}
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
};
int main() {
Final student;
student.inputInternalMarks();
student.inputExternalMarks();
student.calculateResults();
return 0;
OUTPUT:
QUE.17 Write a program for Patient Appointment Details using Multiple Inheritance. Define a base
class Patient with Patient_Name and Disease_Name. Defne another base class Hospital with
Hospital_Name and City. Create a derive class Appointment with data members as Doctor_Name
and Consulting_Fees. Display all apointment details using a member function.
CODE:
#include <iostream>
using namespace std;
class Internal {
protected:
float IOOP, FOS, FCBP, BME, FCN;
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
public:
void inputInternalMarks() {
cout << "Enter Internal Marks (IOOP, FOS, FCBP, BME, FCN): ";
cin >> IOOP >> FOS >> FCBP >> BME >> FCN;
};
class External {
protected:
float IOOP, FOS, FCBP, BME, FCN;
public:
void inputExternalMarks() {
cout << "Enter External Marks (IOOP, FOS, FCBP, BME, FCN): ";
cin >> IOOP >> FOS >> FCBP >> BME >> FCN;
};
class Final : public Internal, public External {
public:
void calculateResults() {
float totalMarks = IOOP + FOS + FCBP + BME + FCN;
float percentage = (totalMarks / 500) * 100;
string grade;
if (percentage >= 75) grade = "Distinction";
else if (percentage >= 60) grade = "First";
else if (percentage >= 50) grade = "Second";
else if (percentage >= 40) grade = "Pass";
else grade = "Fail";
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
cout << "Total Marks: " << totalMarks << ;
cout << "Percentage: " << percentage << "%" << ;
cout << "Grade: " << grade << ;
};
int main() {
Final student;
student.inputInternalMarks();
student.inputExternalMarks();
student.calculateResults();
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.18 Write a program for Patient Appointment Details using Multiple Inheritance. Define a base
class Patient with Patient_Name and Disease_Name. Defne another base class Hospital with
Hospital_Name and City. Create a derive class Appointment with data members as Doctor_Name
and Consulting_Fees. Display all apointment details using a member function.
CODE:
#include <iostream>
using namespace std;
class Surname {
protected:
string surname;
public:
void inputSurname() {
cout << "Enter Surname: ";
cin >> surname;
};
class Father : public Surname {
protected:
string Middle_Name;
public:
void inputMiddleName() {
inputSurname();
cout << "Enter Middle Name: ";
cin >> Middle_Name;
}
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
};
class Child : public Father {
private:
string First_Name;
public:
void inputFirstName() {
inputMiddleName();
cout << "Enter First Name: ";
cin >> First_Name;
void displayFullName() {
cout << "Full Name: " << First_Name << " " << Middle_Name << " " << surname << ;
};
int main() {
Child child;
child.inputFirstName();
child.displayFullName();
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.19 Write a program for Patient and Chemist details using Inheriatnce. Define a base class
Patient to accept Patient_ID and Name. Create an intermediate class Doctor with Doctor_Name and
Speciality. Derive a class Chemist from Doctor with Medicine_Name, Quantity and Price. Display all
the details using a member function defined outside the class.
CODE:
#include <iostream>
using namespace std;
class Patient {
protected:
int Patient_ID;
string Name;
public:
void inputPatientDetails() {
cout << "Enter Patient ID: ";
cin >> Patient_ID;
cout << "Enter Patient Name: ";
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
cin >> Name;
};
class Doctor : public Patient {
protected:
string Doctor_Name;
string Speciality;
public:
void inputDoctorDetails() {
inputPatientDetails();
cout << "Enter Doctor Name: ";
cin >> Doctor_Name;
cout << "Enter Speciality: ";
cin >> Speciality;
};
class Chemist : public Doctor {
private:
string Medicine_Name;
int Quantity;
float Price;
public:
void inputChemistDetails() {
inputDoctorDetails();
cout << "Enter Medicine Name: ";
cin >> Medicine_Name;
cout << "Enter Quantity: ";
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
cin >> Quantity;
cout << "Enter Price: ";
cin >> Price;
void displayDetails() {
cout << "Patient ID: " << Patient_ID << ;
cout << "Patient Name: " << Name << ;
cout << "Doctor Name: " << Doctor_Name << ;
cout << "Speciality: " << Speciality << ;
cout << "Medicine Name: " << Medicine_Name << ;
cout << "Quantity: " << Quantity << ;
cout << "Price: " << Price << ;
};
int main() {
Chemist chemist;
chemist.inputChemistDetails();
chemist.displayDetails();
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
QUE.20 Write a program for Area Calculation of different shapes using inheritance. Define a base
class Area to accept Length and Width. Derive three subclasses: Rectangle to calculate L * W, Square
to calculate L * L, and Cuboid to Calculate 2 (LW + LH + WH). Implement member functions in their
respective derived classes.
CODE:
#include <iostream>
using namespace std;
class Area {
protected:
float length;
float width;
public:
void inputDimensions() {
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
cout << "Enter Length: ";
cin >> length;
cout << "Enter Width: ";
cin >> width;
};
class Rectangle : public Area {
public:
float calculateArea() {
return length * width;
};
class Square : public Area {
public:
float calculateArea() {
return length * length; // Assuming length is the side of the square
};
class Cuboid : public Area {
public:
float calculateArea() {
return 2 * (length * width + length * width + width * width);
};
int main() {
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
Rectangle rect;
rect.inputDimensions();
cout << "Area of Rectangle: " << rect.calculateArea() << ;
Square sq;
sq.inputDimensions();
cout << "Area of Square: " << sq.calculateArea() << ;
Cuboid cub;
cub.inputDimensions();
cout << "Surface Area of Cuboid: " << cub.calculateArea() << ;
return 0;
OUTPUT:
QUE.21
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
CODE:
#include <iostream>
using namespace std;
class GrandFather {
protected:
int No_of_Houses;
public:
void setHouses(int houses) {
No_of_Houses = houses;
};
class Father : public GrandFather {
protected:
int Plot_Area;
public:
void setPlotArea(int area) {
Plot_Area = area;
};
class Mother {
protected:
int Gold_Occupied;
public:
void setGoldOccupied(int gold) {
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4
Gold_Occupied = gold;
};
class Son : public Father, public Mother {
public:
void displayTotalProperty() {
cout << "Total Property Details of Son:" << ;
cout << "Number of Houses: " << No_of_Houses << ;
cout << "Plot Area: " << Plot_Area << " square feet" << ;
cout << "Gold Occupied: " << Gold_Occupied << " grams" << ;
};
int main() {
Son son;
son.setHouses(3);
son.setPlotArea(5000);
son.setGoldOccupied(100);
son.displayTotalProperty();
return 0;
OUTPUT:
CTUC103 IOOP
24BSIT080
ASSIGNMENT-4