QUESTION 1 public class Point private double xy. public Point double double y this.x x this yoy: 3 public Point(Point other) this(other.xother.y); > public double getxo ( return x) public void setX(double x) { this.x = x;} public double getyo (return y.) public void setY(double y) { this.y - y) public static double distance(Point p1, Point p24 return Math.sqrt(Math.pow(p1.x-p2.x, 2) + Math.powipl.y-p2.y,2)): > } Car objects defined by its socation and speed. Given the point class shown above, implement the cos Car based on the UML agam and the following guidelines 1. Implement al methods and constructors shown in the UML diagram. 2. The maximum speed is 100. Make sure SetSpeed double method does not exceed this tot 3. The moveTo(Point method takes a destination point as a parameter and returns the time needed for the car to reach the point. The time is calculated as the distance divided by speed. The method should also update the cars location 4. Two cars are equal if they have the same speed and location Joc. Point speed double • Caro Car (Point double) CarCar .setSpeed (double vold - move To (Point double .equals Car boolean For the rear greSS AT-F10 (PCI O ALT:FNF19 M
没有找到相关结果