Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started