Question
c++ programming 1.2) Class PointXY The class PointXY will be used below in questions in this exam. class PointXY { public: PointXY() { x =
c++ programming 1.2) Class PointXY The class PointXY will be used below in questions in this exam. class PointXY { public: PointXY() { x = 0; y = 0; } void set(double a, double b) { x = a; y = b; } double getx() const { return x; } double gety() const { return y; } private: double x, y; } This question uses the class PointXY defined in Sec. 1.2 and the class Polygon defined in Question 2. Write a function rotate90 with the following signature. PointXY rotate90(const PointXY &u); Math formula: 1. If the coordinates in u are (x, y), the coordinates in the output object are (?y, x). 2. This is the mathematical operation of rotating a point counterclockwise through 90? . Write a function rotate90 with the following signature. Polygon rotate90(const Polygon &p); 1. If the points in the polygon p are vi , the points in the output object are rotate90(v[i]). 2. This is the mathematical operation of rotating a polygon counterclockwise through 90? . Hence if q = rotate90(p), then the polygon q is the polygon p rotated counterclockwise through 90? . Note: 1. You may assume the polygon p is not empty. 2. Do not waste time on validation checks to test if num <= 0 in p.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started