Question: C++ Implement a class Rectangle. Provide a constructor to construct a rectangle with a given width and height, member functions get_perimeter and get_area that compute

C++C++ Implement a class Rectangle. Provide a constructor to construct a rectangle

Implement a class Rectangle. Provide a constructor to construct a rectangle with a given width and height, member functions get_perimeter and get_area that compute the perimeter and area, and a member function void resize(double factor) that resizes the rectangle by multiplying the width and height by the given factor.

Implement a printRectangle as follows in your Rectangle class file:

void printRectangle (const Rectangle& rect) { cout cout cout cout }

Put this code in your *.cpp at the end to test your Rectangle class:

int main() { Rectangle rec1 (3.0, 4.0);

printRectangle (rec1); rec1.resize(2.5); cout printRectangle (rec1); return 0; }

Implement a class Rectangle. Provide a constructor to construct a rectangle with a given width and height, member functions get_perimeter and get_area that compute the perimeter and area, and a member function void resize(double factor) that resizes the rectangle by multiplying the width and height by the given factor

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!