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
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 29SA
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
|
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
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr