Create a class Polar that represents the points on the plain as polar coordinates (radius and angle).
Answers
Answered by
0
Explanation:
create a overloaded+operator of addition two polar quantities. "adding" two points in the plain can be accomplished by adding their X coordinates and then adding their Y coordinates. this given then X and Y coordinates of the answer. thus you'll need to convert two sets of polar coordinates to rectangular coordinates, and them then covert the resulting rectangular
represent back to polar.
use the following main function to test the class polar.
int main()
{
polar p1(10.0,0.0)//line to the right
polar p2(10.0,1.5707906325)// line straight up
polar p3// unintialized polar
p3—p1+p2// add two polars
cout<<"\np1—"p1.display()// display all polars
cout <<"\np2—"p2.display ()
cout <<"\ np2—"p3. display()
cout<<endl
return0
}
output
p1—(10,0)
p2—(10,1.5708)
p3—(14.1421,0.785398)
Similar questions