Question: Your task in this homework assignment is to refactor a program using the struct construct to analyze and manipulate points. Solution Specifications Your solution to
Your task in this homework assignment is to refactor a program using the struct construct to analyze and manipulate points.
Solution Specifications
Your solution to this problem must meet the following criteria.
- Define two data structures, one for a cartesian point CartesianPoint and another for a polar point PolarPoint.
- Replace the code that uses (x,y) with code using a cartesian point structure.
- Replace the code that uses (r,t) with code using a polar point structure.
- When you can return a single structure from a function do so (rather than using pass-by-reference to get to multiple values).
- After updating the functions, the following should true about each function:
- CartesianToPolar should take a cartesian point as a parameter and return a polar point.
- PolarToCartesian should take a polar point as a parameter and return a cartesian point.
- LengthC should take a cartesian point as a parameter and return a double.
- NormalizedC should take a cartesian point point as a parameter and return a cartesian point.
- DotProductC should take two cartesian points as parameters and return a double.
- SumC should take two cartesian points as parameters and return a return a cartesian point.
You must product output matching the existing output, but change the internals of the code.
USING C++ LANGUAGE: In file main.cpp

IN file points.cpp

In file points.h

Edit points.cpp and possibly points.h for struct construct
#include "points.h" * /*==================================================================== * Main program */ int main() { double x1 = 1.0, y1 = 2.0; cout // for cin and cout #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
