Question: must be done in C++ . Write a complete program that has the definition of a class Rectangle and a main function. The Rectangle class

 must be done in C++ . Write a complete program that

must be done in C++

. Write a complete program that has the definition of a class Rectangle and a main function. The Rectangle class contains: A private data member length of type integer. A private data member width of type integer. A default constructor that assigns the values 5 and 3 to length and width, respectively. An overloading constructor that accepts two arguments of type integer and assigns them to length and width. An overloading constructor that accepts one argument of type integer and assigns it to both length and width. A member function called getArea that accepts no parameters and returns the area of the rectangle. In your main function declare an array of five rectangles and initialize it using the following partial initialization list: {Rectangle (10,5), Rectangle (8,5), Rectangle (7)} Then use a for loop to display the areas of the five objects in the array as follows: Area of Rectangle 1 is: 50 Area of Rectangle 2 is: 40 Area of Rectangle 3 is: 49 Area of Rectangle 4 is: 15 Area of Rectangle 5 is: 15

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!