Make a base class for a Polygon

The private members

  • numOfSides : int
  • sides[ ]: int // listed in clockwise order , MAX sides is 100

The attributes

  • + Polyon(numSides:int) // default is 0
  • + set(sideNum: int, value:int) : void// ensures no negative side values
  • + get (sideNum:int):int // returns the value of sides[sideNum]
  • + perimeter(): int virtual// returns the perimeter of the polygon
  • + area(): double virtual //returns the area of the polygon

Make a class for Rectangle derived from Polygon

The attributes

  • + Rectangle()// class Polygon(4);
  • + area() // appropriately
  • + perimeter()() // appropriately

Make a class for Square derived from Rectangle

The attributes

  • + Square()// appropriately
  • + area() // appropriately
  • + perimeter() // appropriately

Make a class for RightTri derived from Polygon

The attributes

  • + RightTri()// class Polygon(3); //. Assumes the order side, side, hypotenus
  • + area() // appropriately
  • + perimeter() // appropriately

Make a class for RectSolid derived from Rectangle

The members

  • -height: int

The attributes

  • + volume ()// returns the volume

In your main

  • Make a an array of pointers to Polygon and add an instance Of a rectangle with sides of length 4 and 10
  • A square with sides of length 5
  • A right triangle with sides 3, 4 and 5
  • A rectangular solid with sides of length 6 and 3 and height 5.
  • Use the array to have each shape print out its area perimeter , as well As the rectangular solid print out its volume.
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.