Write a class Point that represents a two-dimensional point (x,y) in the Java programming language. Two-Argument
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a class Point that represents a two-dimensional point (x,y) in the Java programming language.
- Two-Argument Constructor to set the Point object to a particular point
- Zero-Argument Constructor to set the Point object to (0,0)
- Two Accessor Methods --> double getX() | double getY()
This class should be immutable (if possible) but include a method Point translation(double dx, double dy), which returns a new point after moving this point dx in the x direction and dy in the y direction. This method should NOT mutate the object executing the method.
- toString() Method --> Returns Standard (x,y) Representation of Point
- equals() Method
Posted Date: