Public Class Point2extends Javalangobject Q2 Javalangobject Lab1package2vector2 Q43903130
- public class Point2extends java.lang.Object

Q2- java.lang.Object
-
- lab1package2.Vector2

public void movex (double dx) Move the point in the x direction by an amount dx. The new x coordinate of the point is equal to (this.getX() + dx). Parameters: dx – the change in the x coordinate of this point public java.lang.String toString() Returns a string representation of this point. The string representation of this point is the x and y-coordinates of this point, separated by a comma and space, inside a pair of parentheses. Overrides: toString in class java.lang. Object Returns: a string representation of this point public static Vector2 dirvector (double theta) Returns the vector having magnitude one pointing in the direction theta degrees from the x axis. The components of the vector are equal to (Math.cos(rad), Math.sin(rad)) where rad is theta expressed in radians. Parameters: theta – the direction that the vector is pointing in measured in degrees from the x axis Returns: the unit vector pointing in the given direction Show transcribed image text public void movex (double dx) Move the point in the x direction by an amount dx. The new x coordinate of the point is equal to (this.getX() + dx). Parameters: dx – the change in the x coordinate of this point
public java.lang.String toString() Returns a string representation of this point. The string representation of this point is the x and y-coordinates of this point, separated by a comma and space, inside a pair of parentheses. Overrides: toString in class java.lang. Object Returns: a string representation of this point
public static Vector2 dirvector (double theta) Returns the vector having magnitude one pointing in the direction theta degrees from the x axis. The components of the vector are equal to (Math.cos(rad), Math.sin(rad)) where rad is theta expressed in radians. Parameters: theta – the direction that the vector is pointing in measured in degrees from the x axis Returns: the unit vector pointing in the given direction
Expert Answer
Answer to public class Point2 extends java.lang.Object Q2 java.lang.Object lab1package2.Vector2…
OR