Question: Need help finishing the point class by adding a constructor and finishing the distanceFrom function in the code. Then after finishing the code creating a

Need help finishing the point class by adding a constructor and finishing the distanceFrom function in the code. Then after finishing the code creating a new program that takes 4 double inputs that turn into 2 points and then calculating the distance from said points. Any help is much appreciated, have been stuck on this bit. Thanks  Need help finishing the point class by adding a constructor and
finishing the distanceFrom function in the code. Then after finishing the code

2. Using the class Point given (see Point.java below), create a constructor for Points that takes two arguments, an x position and a y position, and produces a new Point object from them. 3. Using the class Point given (see Point.java below), finish the distanceFrom function. It should behave as described in the comment in the provided file, computing the Euclidean distance between two points. It should not round its result, but return all significant digits. 4. Using the class Point given (see Point.java below) and your edits to it, create a new program that instructs the user on what to input, takes four user inputs, creates two Point objects with those user inputs, and then prints the resulting distance in the following way: The distance between (x,y) and (p,q) is NN.NNN, which has been rounded down to three decimal places. public class Point { private double xPos; private double yPos; public Point() { xPos = 0; yPos = 0; I/TODO: Implement constuctor public double getX() { return xPos; } public double getY() return yPos; This function should compute the distance from the current point P to another point Q, using the standard Euclidean distance formula di(P.x-Q.x)^2 + (P.y- Q.y)^2) 1 public double distanceFrom(Point otherPoint) { //TODO: Implement function return 0.0; } public String toString() { return "(" + xPos +","+yPos + ")"; )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!