Question: C++ Question Note: DO NOT USE VECTORS Develop and write a class that represents a rectangle . You are going to need to determine a

C++ Question

Note: DO NOT USE VECTORS

Develop and write a class that represents a rectangle. You are going to need to determine a rectangle's length, height and area. This should be a well formed class with appropriate interfaces and access control. You will only need two member variables. For this particular application, set methods for length and height are appropriate.

Your rectangle should have a method to *print both the parameters, but also a graphical representation of the rectangle.

As an example for a rectangle that is h: 3 x L: 5:

 ***** * * ***** Height: 3, Length: 5, Area: 15

Once made a rectangle cannot be copied. Place a single cout statement in the constructor of your rectangle. Every time a rectangle is created the constructor will output to the screen. This should only happen 10 times total for your whole piece of code.

Create an array of 10 rectangles. After creating this array, assign each rectangle a random height and length, each between 1 and 15. This should be a for loop that uses the rectangle's set interfaces.

Write four functions that interact with your array of rectangles:

  • One function that finds the area of all of the rectangles in the array.
  • One function that finds the longest rectangle and calls its print method. Deal with ties appropriately.
  • One function that finds the tallest rectangle and calls its print method. Deal with ties appropriately.
  • One function that finds the rectangle with the largest area and calls its print method. Deal with ties appropriately.

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!