Question: Write a class called polygon which can initialise regular 1 Two - Dimensional ( 2 D ) polygons, and translate them in the + /
Write a class called polygon which can initialise regular TwoDimensional D polygons, and
translate them in the x and y directions or both x and y It should also be able to rotate
them by any number of degrees about any point. Come up with your own names for all class
members except N and r The following members must be included in your class, exactly as
instructed, and must serve a meaningful purpose in your program:
Private members:
o Member of type std::string, to store a userdefined polygon name egt
Note: the userdefined polygon name must always take the form li where
l is a letter, i an integer; this also applies in ProgramB.
o Member r of type double, to store the radius.
Regular means that all the polygons internal angles are the same, and all edges are of identical length.
o Member N of type integer, to store the number of vertices.
o Member of type std::vector, to store the xcoordinates of the polygon vertices.
o Member of type std::vector, to store the ycoordinates of the polygon vertices.
o Member function which prints any objects name, number of vertices and coordinates
as a coordinate pair for each vertex on screen using the standard output stream. The
printed output must take the following exact form although obviously the user
defined polygon name, the coordinates and the number of coordinate pairs will vary
All numerical printed output should be rounded to decimal places:
tpolygon
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
