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

Hello I need help doing this practice homework project in netbeans, thanks! 1) W

ID: 3550708 • Letter: H

Question

Hello I need help doing this practice homework project in netbeans, thanks!


1) 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

2) Write a Line class. A Line should have the following:
- two private Point fields, p1 and p2, representing two points of the LineSegment
- a constructor that takes two Point parameters with which to initialize a Line's fields
- get and set methods for the two points
- an intersects method that takes a Line parameter and will return a new Point object representing where the two Lines intersect. If the two Lines are parallel, you should return null. The header will look like this: "public Point intersects (Line otherLine)".


3) Write 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).

For this current project, you do not have to account for vertical lines.

Explanation / Answer

Dear,


/****************************************************

*Class Point is used to store and process x-y plane*

*information.                                     *

****************************************************/

class Point

{

     // declaring data members

     private double x;

     private double y;

     // Empty constructor

     public Point()

     {

          this.x=0;

          this.y=0;

     }

     // Constructor with variables

     public Point(double x, double y)

     {

          this.x = x;

          this.y = y;

     }

     // Used to set the new x-coordinate

     public void setX(double x)

     {

          this.x = x;

     }

     // Used to set the new y-coordinate

     public void setY(double y)

     {

          this.y = y;

     }

     // returns x-coordinate value

     public double getX()

     {

          return x;

     }

     // returns y-coordinate value

     public double getY()

     {

          return y;

     }

     // prints the points

     public void print()

     {

     System.out.println("Point("+x+","+y+")");

     }

}

Multiple questions plz do post remaining in another post.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote