Question: in c++ please Write a class Rectangle , which has two data members, namely, length and width . It has member functions that calculates and
in c++ please
Write a class Rectangle, which has two data members, namely, length and width. It has member functions that calculates and prints out, the rectangle's perimeter ( ) and area ( ). Write member functions to set and get length and width attributes. You must also provide a default constructor that sets length =0 and width = 0 and a constructor with parameters.
Perimeter = 2*(length + width)
Area =length * width
In the main program do the following:
- Create an object of type Rectangle.
- Read the objects length and width from the user.
- Print the rectangles perimeter and Area to the user.
A sample run is given below:

Please enter the length and width : 2.2 3.4 Perimeter is : 11.2 Area is : 7.48
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
