Question: In Reference to JAVA public class Point { private double myX; private double myy: Which of the following would be the best specification (method header)

In Reference to JAVA public class Point { private double myX; privateIn Reference to JAVA

public class Point { private double myX; private double myy: 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 LineSegment ? (A)public double distanceToPoint() // Creates a Point with coordinates (X,Y) public Point (double x, double y) { /* implementation not shown */ } (B)public void distanceToroint (Point p, double d) 11 other methods not shown (C)public double distanceToroint (Point p) } public class Line Segment | (D)public void distanceToPoint() private Point start; private Point end; (E) public double distanceToPoint (Point p, Point start, Point end) // Creates a LineSegment between the coordinates at the 11 'start' Point to the 'end' Point public Linesegment (Point start, Point end) { /* implementation not shown */ What is printed to the console when the following code segment is executed? } // other methods not shown MyClass a = new MyClass (20, 20); System.out.println(a.foo (0, 10)); } What is printed to the console when the following code segment is executed? MyClass a = new MyClass (20, 20); System.out.println(a.foo (10, 10)); (A) Nothing is printed, since an Exception occurs (B) An integer value between 1 and 10 (C) An integer value between 10 and 100 (D) An integer value greater than 100 (E) None of the above (A) Nothing is printed, since an Exception occurs (B) An integer value between 1 and 10 (C) An integer value between 10 and 100 (D) An integer value greater than 100 (E) None of the above

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!