Subject Computer Science Java Programming


Given the following set of X,Y points

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

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse 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...

This is only a preview of the solution. Please use the purchase button to see the entire solution


or $1 if you
register a new account!

Related Homework Solutions

Get help from a qualified tutor
Live Chats