Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

NOTE: Please make the program medium/advance programming some of the codes I hav

ID: 3624864 • Letter: N

Question

NOTE: Please make the program medium/advance programming some of the codes I have not learned yet. Thank You

                                               Two Dimensional Shape

                                             Circle    Square     Triangle

NOTE: The text Circle, Square, and Triangle should be in a box with arrows pointing tothe text that should be in a box that says: Two Dimensional Shape Above, I had a hard time trying to make boxes and arrows above.

Based on the above hierarchy, please define classes as following:

TwoDimensionalShape:

            Member functions: pure virtual function for GetArea

Circle:     Private data member: radius

            Member function: constructor, GetArea

Square:     Private data member: length

            Member function: constructor, GetArea

Triangle:   Private data members: base and height

            Member function: constructor, GetArea

Each TwoDimensionalShape should cotain a virtual function GetArea to calculate the area of the shape. Use the following main function to test your classes.

int main()

{

Circle c(10);

Square s(10);

Triangle t(10,5);

c.GetArea();                                  // will display “The area of circle is 314”

s.GetArea();                                  // will display “The area of square is 100”

t.GetArea();                                   // will display “The area of triangle is 25”

TwoDimensionalShape *shape[] = { new Circle(5), new Square(5), new Triangle(20,5)};

for (int i = 0; i < 3; i++)

        shape[i] -> GetArea();

return 0;

}

Explanation / Answer

Answer question