Question: Write a C++ program that has a Polygon interface that has abstract functions, area(), and perimeter(). Implement classes for Triangle, Quadrilateral, Pentagon, Hexagon, and Octagon,
Write a C++ program that has a Polygon interface that has abstract functions, area(), and perimeter(). Implement classes for Triangle, Quadrilateral, Pentagon, Hexagon, and Octagon, which implement this interface, with the obvious meanings for the area() and perimeter() functions. Also implement classes, Isosceles Triangle, Equilateral Triangle, Rectangle, and Square, which have the appropriate inheritance relationships. Finally, write a simple user interface that allows users to create polygons of the various types, input their geometric dimensions, and then output their area and perimeter. For extra effort, allow users to input polygons by specifying their vertex coordinates and be able to test if two such polygons are similar.
Step by Step Solution
3.59 Rating (188 Votes )
There are 3 Steps involved in it
include using namespace std class Polygon protected int width height public Polygon int a int b widtha heightb virtual int area void 0 virtual int per... View full answer
Get step-by-step solutions from verified subject matter experts
