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
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