Question: C++ coding Define a Rectangle class that defines a Rectangle object in terms of two Integer data members, length, and width. The Implementation of your



Define a Rectangle class that defines a Rectangle object in terms of two Integer data members, length, and width. The Implementation of your class should have Constructors: One default constructor so that Rectangle ri; will create a Rectangle object with default length and width equal to zero. One constructor that lets us create a Rectangle object with given length and width: Rectangle r2(2,5); This rectangle has length 2 and width 5. Member functions: Let there be accessor functions get_length() and get_width which return the length and width, respectively, of a Rectangle objects. For convenience, add one member function print() which has the effect of printing out a Rectangle object with its defining values. Example: r2.print(); could appear printed like: Rect[2:5] Let your program also have two Boolean "stand-alone" (non member functions) which both take two parameters of type Rectangle and return value true if the first parameter is larger than the second parameter in terms of rectangle perimeter or area respectively: bool larger_in_perimeter(Rectangle r1, Rectangle r2) {....) bool larger_in_area(Rectangle ri, Rectangle 12). For this assignment, place all code for class Rectangle and both larger_in ... functions in a file Rectangle.h Test your Rectangle class with the following provided main() function: inalude
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
