Question: ANSWER IN JAVA PLEASE Task #1 Design and implement a Java class called MyPoint2D (MyPoint2D.java) in a package named ca.cpan155.firstname that works the same the
ANSWER IN JAVA PLEASE

Task #1 Design and implement a Java class called MyPoint2D (MyPoint2D.java) in a package named ca.cpan155.firstname that works the same the javafx.geometry.Point2D class with the following constructors and methods. as ca.cpan155.firstname. MyPoint2D +MyPoint2D(x: double, y: double) +distance(x: double, y: double): double +distance(p: MyPoint2D): double Constructs a MyPoint2D object with the specified x- and y- coordinates. Returns the distance between this point and the specified point (x, y). Returns the distance between this point and the specified point p. Returns the x-coordinate from this point. Returns the y-coordinate from this point. Returns the midpoint between this point and point p. Returns a string representation for the point. +getX(): double +getY(): double +midpoint(p: MyPoint2D): MyPoint2D +toString(): String . Please pay attention to the following notes: Replace the firstname in the package name with your own first name. Please refer to the recorded session, slides and sample codes regarding the functionality of the javafx.geometry.Point2D class. You need to infer data fields from the methods mentioned above and define the inferred data fields as needed. You can use the following formula to calculate midpoint and distance in your MyPoint2D class. 2 X 1 P1: X1 = 3, y, = 1 d 2 d = sqrt((x2 - Xq)2 + (y2 - 41)2) P2: X2 = 1, y2 = 2 3 midpoint: Xm = (x1 + x2)/2, Ym = (y1 + y2)/2 Y . You are not allowed to call Point2D methods in your own class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
