Question: java Implement the equals method of the Arrow class. Two arrows are equal when they have the same starting point and direction. Arrow.java 1 public

 java Implement the equals method of the Arrow class. Two arrows

are equal when they have the same starting point and direction. Arrow.java

java

Implement the equals method of the Arrow class. Two arrows are equal when they have the same starting point and direction. Arrow.java 1 public class Arrow 2 3 private int x; private int y: private String direction; Constructs an arrow @param x the x-position @param y the y-position @param direction a compass direction NES NE NW SE S - public Arrow int x, int y, String direction) this.x = x this.y = y: this direction = direction Checks whether this arrow is cual to another @param otherObject another arrow @return true if this arrow and otherObject have th sante position and direction public boolean equals(Object otherObject) Arrow Tester.java I public class Arrow Tester public static void main(String[] args) muino Arrow arrowl = new Arrow l. 2, "SE"): Object arrow 2 = new Arrow(1, 2. "W"): Arrow arrow 3 = new Arrowl, 0, "SE"); Arrow arrow = new Arrowie. 2. "SE"); Arrow arrow = new Arrowl. 2, "SEE".substring ASASARANN System.out.printlnarrowl.equals(ar System.out.printing Expected: true System.out.println(arrowl.equals(arrow2) System.out.println("Expected: false System.out.println(arrowl.equalsiar 27 System.out.println("Expected: false System.out.printlnarrowl.equals(atrol System.out.printlnt Expected: false System.out.println(arrowl.equalsianto System.out.println("Expected: true - 9. Implement the toString method of the following version of the Arrow class. Return strings such as (1, 2) SE Arrow.java 1 public class Arrow 2 private int x; private int y private String direction; Ecovouw Constructs an arrow. param the x-position @paramly the y-position @param direction a compass direction. N ESKNE NW SE SW public Arrow(int x, int y. String direction) this.x = x this.y y this direction = direction: Gets a string representation of this arrow @return the string representation such as 1 2 NW public String toString() 28 ArrowTester.java 1 public class ArrowTester public static void main(String[] args) motor Arrow arrowl = new Arrow 1 2 SE System.out.println(arrowl): System.out.println("Expected: (1 2 SE Arrow atro2 = new Acrown. W System.out.printlnarrow2]; System.out.println Expected

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!