Question: This is in Reference to JAVA. Thanks. refer to the following declarations: In a Java program which of the following correctly declares and initializes an

This is in Reference to JAVA. Thanks. refer to the following declarations:This is in Reference to JAVA. Thanks.

refer to the following declarations: In a Java program which of the following correctly declares and initializes an object Line segment seg from the coordinates (1.0, 2.0) to (5.0, 6.0) ? public class Point { private double myX; private double myy: (A) LineSegment seg = new Linesegment(); seg start = new Point(1.0, 2.0); seguend = new Point(5.0, 6.0); // Creates a Point with coordinates (X,Y) public point (double x, double y /* implementation not shown / 1 (B) LineSegment seg = new Line segment(); seg start = new Point(); seg, startmyx = 1.0; ssustartYX = 2.0; segend = new Point(); ssssnd.myx = 5.0; sss.snd.mxX = 6.0; // other methods not shown 1 (C) Line segment seg new LineSegment (1.0, 2.0, 5.0, 6.0); public class LineSegment ! private Point start; private Point end; (D) LineSesment seg - new Linesegment1(1.0, 2.0), (5.0, 6.0)); // Creates a LineSegment between the coordinates at the 11 'start' point to the end' Point public Line Segment (Point start, Point end) /* implementation not shown 1 (E) Point pl = new Point(1.0, 2.0); Point p2 = new Point(5.0, 6.0); Linssement seg - new Line segment (p1, p2); Which of the following would be the best specification (method header) for a new LineSegment method named distanceTopoint that calculates the shortest distance from the point to the Line Segment ? // other methods not shown ) (A)public double distanceToPoint() (B)public void distanceToroint (Point p, double d) (C)public double distanceTopoint (Point p) (D)public void distanceTopoint () (E) public double distanceToPoint (Point p, Point start, Point end)

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!