Question: Write the definition of a class Rectangle containing: A data member length of type double. A data member width of type double. A member function

 Write the definition of a class Rectangle containing: A data member

Write the definition of a class Rectangle containing: A data member length of type double. A data member width of type double. A member function called setLength that accepts a parameter and assigns it to length. The function returns no value. A member function called setWidth that accepts a parameter and assigns it to width. The function returns no value. A member function called getArea that accepts no parameters and returns the area of the rectangle. A member function called getPerimeter that accepts no parameters and returns the perimeter of the rectangle. A member function called getDiagonal that accepts no parameters and returns the diagonal of the rectangle. Note: The following figure illustrates how the length of a rectangle's diagonal can be obtained. b a d = a + b2

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!