Question: Write a C++ class named Rectangle that represents rectangle objects. A Rectangle should have two double data type member variables preferably named length and width

 Write a C++ class named Rectangle that represents rectangle objects. A

Write a C++ class named Rectangle that represents rectangle objects. A Rectangle should have two double data type member variables preferably named length and width Add a default constructor that assigns length and width member variables the default value of 1.0 each Add a non default constructor that takes two arguments and assigns the arguments to the member variables Add getters (getLength and getWidth) and setters (setLength and setWidth) Add a member function named getArea that does not take any argument and returns the area of the rectangle Add a member function named getPerimeter that does not take any argument and returns the perimeter of the rectangle given by 2*length + 2*width Add a member function named print that does not take any argument and prints the rectangle object appropriately (for example we may print the length, width, area, and perimeter in a nice format) Use the program given below to test your class design CMDT135

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!