## Question

X Y

86.92 2.47

70.93 27.81

97.74 34.36

30.90 35.14

51.66 31.70

0.830 21.77

55.91 66.62

32.92 75.23

65.26 72.53

83.90 4.710

Develop a Cartesian class which can convert Polar to Cartesian in a constructor and determine the distance between two Cartesian points in a method. Use it to determine the total distance from the first to the last point.

Develop a Polar class which can convert Cartesian to Polar in a constructor and determine the distance between two Polar points in a method. A single instance of Polar only has a Rho and Theta and likewise a single instance of Cartesian only has an X and Y. The Polar coordinates should go from [-pi, pi]. Use it to convert each of the Cartesian points to Polar and then determine the total distance through all points from the first to the last point.

Include the following sections with your submission:

Reqts – A text description of what is performed

Design – A text or preferably graphical depiction of how it is performed

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

public class Cartesian {//Declare cartesian using polar coordinates

public Cartesian(double theta, double rho)

{

x = rho * Math.cos(theta);

y = rho * Math.sin(theta);

}

//Declare cartesian point using cartesian coordinates, uses boolean just to differentiate the two constructors

public Cartesian(double x, double y, boolean cartesian)

{

this.x = x;

this.y = y;

}

//Set X value for coordinate

public void setX(double x)

{

this.x = x;

}

//Set Y value for coordinate

public void setY(double y)

{

this.y = y;

}

//Get X value of coordinate...

By purchasing this solution you'll be able to access the following files:

Solution.java, Solution1.java and Solution2.java.