Subject Computer Science Java Programming

Question

Given the following set of X,Y points

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

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

Related Homework Solutions

Array Problems in Java: Summation, Average, Min/Max, Searching, Sorting
Homework Solution
$13.00
Java
Programming
Coding
Computer Science
Arrays
Summation
Average
Minimum Number
Maximum Number
Bubble Sort
Selection Sort
Sequential Search
Binary Search
Algorithms
Input
Output
Methods
Integers
Functions
Generic Method For Java Arrays
Homework Solution
$20.00
Java
Programming
Coding
Computer Science
Arrays
Items
Generic Method
Integers
WordList
Strings
Testing
Primitive Types
Input
Output
Cylinder Containers in Java
Homework Solution
$25.00
Java
Programming
Codes
Algorithms
Computer Science
Statements
Variables
Loops
Input
Output
Integers
Strings
Geometry
Mathematics
Cylinder
Radius
Finance
Costs
Containers
Companies
Functions
Odd Numbers Problem in Java
Homework Solution
$10.00
Java
Programming
Computer Science
Mathematics
Integers
Odd Values
Even Values
Output
Input
Range
Loops
Conditions
Statements
Samples
Classes in Java Programming
Homework Solution
$20.00
Java
Programming
Coding
Classes
OOP
Instances
Variables
Constructor
Parameters
Loops
Strings
Integers
Conditions
Statements
Setters
Getters
Error Handling
Get help from a qualified tutor
Live Chats