Write a C++ program to calculate the area of the rectangle using the friend function. Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. Create separate classes in separate files. The class Rectangle has the following private attributes. Data Type int int Variable Name length breadth Include appropriate getters and setters for the above class. Define a function to find the area of a rectangle which will be able to access the private data members of the Rectangle class. Method Description void calcArea(Rectangle rec) This function is used to calculate the area and display it. In the main() method, read the length and breadth details from the user and display the area by calling the function. Input and Output Format: Please refer to the sample input and output for formatting specifications. [All text in bold are input and the remaining are output] Sample Input and Output : Enter the length 10 Enter the breadth 20 Area: 200
Write a C++ program to calculate the area of the rectangle using the friend function. Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. Create separate classes in separate files. The class Rectangle has the following private attributes. Data Type int int Variable Name length breadth Include appropriate getters and setters for the above class. Define a function to find the area of a rectangle which will be able to access the private data members of the Rectangle class. Method Description void calcArea(Rectangle rec) This function is used to calculate the area and display it. In the main() method, read the length and breadth details from the user and display the area by calling the function. Input and Output Format: Please refer to the sample input and output for formatting specifications. [All text in bold are input and the remaining are output] Sample Input and Output : Enter the length 10 Enter the breadth 20 Area: 200
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
QUESTION PROVIDED IN ATTACH IMAGE KINDLY SEE. PROVIDE OUTPUT AS IT IS SHOWN IN QUESTION.
AND BELOW TEMPLATES PROVIDED CHECK THIS BEFORE MAKING SOLUTION ( main.cpp , rectangle.cpp)
----------------- TEMPLATES BELOW FOR SOLUTION -----------------------
main.cpp template
#include<iostream> int main()
|
Rectangle.cpp template
#include<iostream> class Rectangle
|
![Write a C++ program to calculate the area of the rectangle using the friend function.
Strictly adhere to the Object-Oriented specifications given in the problem statement. All class
names, member variable names, and function names should be the same as specified in the problem
statement. Create separate classes in separate files.
The class Rectangle has the following private attributes.
Data Type
Variable Name
length
breadth
int
int
Include appropriate getters and setters for the above class.
Define a function to find the area of a rectangle which will be able to access the private data members
of the Rectangle class.
Method
Description
void calcArea(Rectangle rec)
This function is used to calculate the area and display it.
In the main() method, read the length and breadth details from the user and display the area by calling
the function.
Input and Output Format:
Please refer to the sample input and output for formatting specifications.
[All text in bold are input and the remaining are output]
Sample Input and Output :
Enter the length
10
Enter the breadth
20
Area: 200](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F35128bc2-1643-43a3-88ed-ea1eda0801a0%2F814d0256-fb02-4903-abab-20e8bb86dec3%2Fgnpl1k_processed.png&w=3840&q=75)
Transcribed Image Text:Write a C++ program to calculate the area of the rectangle using the friend function.
Strictly adhere to the Object-Oriented specifications given in the problem statement. All class
names, member variable names, and function names should be the same as specified in the problem
statement. Create separate classes in separate files.
The class Rectangle has the following private attributes.
Data Type
Variable Name
length
breadth
int
int
Include appropriate getters and setters for the above class.
Define a function to find the area of a rectangle which will be able to access the private data members
of the Rectangle class.
Method
Description
void calcArea(Rectangle rec)
This function is used to calculate the area and display it.
In the main() method, read the length and breadth details from the user and display the area by calling
the function.
Input and Output Format:
Please refer to the sample input and output for formatting specifications.
[All text in bold are input and the remaining are output]
Sample Input and Output :
Enter the length
10
Enter the breadth
20
Area: 200
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education