Question please answer in java language Exercise 6 Design the CartesianPoint class with instance variables to store coordinates of a two dimensional point (x,y) on the Cartesian plane. The coordinates may be given as floating point values. Write a constructor which takes as input the x and y coordinates Write a default constructor which initialises the point coordinates to zero Create the method double distance From(CartesianPoint q) returns the Euclidean distance between this point and input point q using the following equation (x2 – x1)2 + (y2 – yı)2 You will need to use methods contained within the Math library. Write a method to return true if this point lies on the x-axis and false otherwise Write a method to return true if this point lies on the y-axis and false otherwise

7XPMIA The Asker · Computer Science

please answer in java language

Transcribed Image Text: Exercise 6 Design the CartesianPoint class with instance variables to store coordinates of a two dimensional point (x,y) on the Cartesian plane. The coordinates may be given as floating point values. Write a constructor which takes as input the x and y coordinates Write a default constructor which initialises the point coordinates to zero Create the method double distance From(CartesianPoint q) returns the Euclidean distance between this point and input point q using the following equation (x2 – x1)2 + (y2 – yı)2 You will need to use methods contained within the Math library. Write a method to return true if this point lies on the x-axis and false otherwise Write a method to return true if this point lies on the y-axis and false otherwise
More
Transcribed Image Text: Exercise 6 Design the CartesianPoint class with instance variables to store coordinates of a two dimensional point (x,y) on the Cartesian plane. The coordinates may be given as floating point values. Write a constructor which takes as input the x and y coordinates Write a default constructor which initialises the point coordinates to zero Create the method double distance From(CartesianPoint q) returns the Euclidean distance between this point and input point q using the following equation (x2 – x1)2 + (y2 – yı)2 You will need to use methods contained within the Math library. Write a method to return true if this point lies on the x-axis and false otherwise Write a method to return true if this point lies on the y-axis and false otherwise
Community Answer
WIF8CP

If you have any problem with the code feel free to comment. Program class CartesianPoint { t// instance variables tprivate float x, y; t// parameterized constructor tpublic CartesianPoint(float x, float y) { ttthis.x = x; ttthis.y = y; t} t// default costructor tpublic CartesianPoint() { ttx = 0; tty = 0; t} t// find distance between two points tpublic double distanceFr ... See the full answer