Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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