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
icon
Related questions
Question

QUESTION PROVIDED IN ATTACH IMAGE KINDLY SEE. PROVIDE OUTPUT AS IT IS SHOWN IN QUESTION.

 

AND STRICTLY FOLLOW BELOW TEMPLATES PROVIDED CHECK THIS BEFORE MAKING SOLUTION ( main.cpp , rectangle.cpp)

----------------- TEMPLATES BELOW FOR SOLUTION -----------------------

 

main.cpp template

#include<iostream>
#include<stdlib.h>
using namespace std;

int main()
{

//Fill your code here


return 0;
}

 

Rectangle.cpp template

#include<iostream>
#include<stdlib.h>
using namespace std;

class Rectangle
{
private:
int length;
int breadth;


//Fill your code here

};

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
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Database connectivity
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education