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

write a c++ program that has a Polygon interface that has abstract functions, ar

ID: 3649605 • Letter: W

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, which implement this interface, with the obvious meanings for the area() and perimeter() functions. also implement classes IsoscelesTriangle, EquilateralTriangle, 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.

Explanation / Answer

#include #include #include #include #include #include int gd=DETECT,gm; class myStack { private: int arr[10000][2],top; public: myStack() { top=-1; } void push(int x,int y) { if(top>10000) { printf(" a " Stack Full...:-(""); exit(0); } top++; arr[top][0]=x; arr[top][1]=y; } void pop(int &x,int &y) { x=arr[top][0]; y=arr[top][1]; top--; } int empty(void) { if(top==-1) return(1); else return(0); } }; void show_quadrant() { cleardevice(); rectangle(120,40,320,240); rectangle(320,40,520,240); rectangle(120,240,320,440); rectangle(320,240,520,440); for(int i=130;iy; x+=320; y=240-y; initgraph(&gd,&gm,"..gi"); cleardevice(); show_quadrant(); setcolor(1); drawpoly(num+1,ed); fill_polygon(x,y,15,1); } int check_mid(int i,int ed[20],int k) { int max,min; if(ed[k+1]>ed[k+3]) { max=ed[k+1]; min=ed[k+3]; } if(ed[k+1]min&&i