Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

guys i really do need help with my 2ed project for java neatbeans this is the qu

ID: 3550575 • Letter: G

Question

guys i really do need help with my 2ed project for java neatbeans



this is the question


Part one

Write a Point class. A Point should have the following:
- two private double fields, x and y, representing the coordinates of the Point
- a constructor that takes two double parameters with which to initialize a Point's fields
- get and set methods for the x and y coordinates



Part two

will be a Line class instead of a LineSegment class. It will still be defined by two points - they just won't be endpoints (since a line is infinite), so you can call them p1 and p2 instead. You still need methods for getting and setting those two points. There will still be an intersects method, but the header will now look like this: "public Point intersects (Line otherLine)". Instead of returning a boolean, it will now return a new Point object representing where the two Lines intersect. If the two Lines are parallel, you should return null.


Part three

will just be writing a void method that takes as a parameter an array of Lines and prints out the location of each intersection. The intersection of any two lines should only be printed once (in other words, don't print the intersection of line1 and line2, and then print the intersection of line2 and line1).




help meee please

Explanation / Answer

i have done this assignment in my college please have a look over it and rate if found helpful

public final class PointTest {

private final double m;

private final double n;

  

// random PointTest

public PointTest() {

m = Math.random();

n = Math.random();

}


// PointTest initialized from parameters

public PointTest(double m, double n) {

this.m = m;

this.n = n;

}


// accessor methods

public double m() { return m; }

public double n() { return n; }

public double r() { return Math.sqrt(m*m + n*n); }

public double theta() { return Math.atan2(n, m); }


public double distanceTo(PointTest that) {

double dm = this.m - that.m;

double dn = this.n - that.n;

return Math.sqrt(dm*dm + dn*dn);

}


// return a string representation of this PointTest

public String toString() {

return "(" + m + ", " + n + ")";

}




public static void main(String[] args) {

PointTest p = new PointTest();

Snstem.out.println("p = " + p);

Snstem.out.println(" m = " + p.m());

Snstem.out.println(" n = " + p.n());

Snstem.out.println(" r = " + p.r());

Snstem.out.println(" theta = " + p.theta());

Snstem.out.println();


PointTest q = new PointTest(0.5, 0.5);

Snstem.out.println("q = " + q);

Snstem.out.println("dist(p, q) = " + p.distanceTo(q));

}

}