I have figured out this assignment, but I am having ahard time figuring out the extra credit, Thanks!
Creating a Rectangle class
We have created a representation of a rectangle in C++ andextended it to create multiple representation's of rectangles.Classes can simplify that process considerably. In this assignment,your task is to convert the representation of a rectangle wecreated earlier in the semester to a Rectangle class. The Rectangleclass shall consist of the following:
- The private data shall consist of 4 members:
- length
- width
- area
- perimeter
- Have 1 constructor with the following parameters: length andwidth.
- Have 2 mutators:
- setLength to set/modify the length.
- setWidth to set/modify the width.
- Have 5 accessors:
- getLength to return the length.
- getWidth to return the width.
- getPerimeter to return the perimeter.
- getArea to return the area.
- printObjet to print the representation of the rectangle (usingthe same output criteria of the previous incarnations). NOTE: Thisroutine must print out the following: \"You created a rectangle withthe following characteristics:\" followed by a blank line beforeprinting out the values of the class data.
You then need to create a 'main' program and instantiate 3rectangle objects with different parameters. You also need to printeach rectangle's characteristics.
For this assignment you need to turn in 1 file which containsthe class header and declaration/implementation, and the mainprogram. Don't forget to include your file header.
Expected Output:
Your output shall look like this given the inputs below:
Enter the length of the 1st rectangle: 3
Enter the width of the 1st rectangle: 5
You created a rectangle with the following characteristics:
   width = 5
   length = 3
   perimeter = 16
   area = 15
Enter the length of the 2nd rectangle: 4
Enter the width of the 2nd rectangle: 6
You created a rectangle with the following characteristics:
   width = 6
   length = 4
   perimeter = 20
   area = 24
Enter the length of the 3rd rectangle: 4.1
Enter the width of the 3rd rectangle: 6.2
You created a rectangle with the following characteristics:
   width = 6.2000
   length = 4.1000
   perimeter = 20.6000
   area = 25.4200
EXTRA CREDIT
For 7 points of extra credit:
Store 10 rectangle objects you created in a vector and sequencethrough the vector to print out the 10 rectangle objects.