subject

You have been asked to extend the Point class that represents 2-D (x, y) coordinates. The Point class includes the following public constructors and methods Method/Constructor Description public Point() public Point (int x, int y) public void setLocation(int x, int y) sets the coordinates to the given values public int getx() public int gety() public String toString() public double distanceFronOrigin() | returns the distance from the origin (e, θ) computed as the square root of (x2 + y2) constructs the point (e, e) constructs a point with the given xly coordinates returns the x-coordinate returns the y-coordinate returns String in standard"(x, y)" notation You are to define a new class called Point3D that extends this class through inheritance. It should behave like a Point except that it should be a 3-dimensional point that keeps track of a z-coordinate. You should provide the same methods as the superclass, as well as the following new behavion Method/Constructor Description public Point3D() public Point3D(int x, int y, int z) public void setLocation(int x, int y, int z) sets the coordinates to the given values public int getz() constructs the point (e, e, e) constructs a point with the given xly/z coordinates returns the z-coordinate Some of the existing behaviors from Point should behave differently on Point3D objects . When the original 2-parameter version of the setLocation is called, the 3-D point's x/y coordinates should be set as specified, and the z-coordinate should be set to e . When a 2-D point is printed with toString, it should be returned in an "(x, y, z)" format that shows all three coordinates . A 3-D point's distance from the origin is computed using all three coordinates, it is equal to the square root of (x2 +y2 + z'2) You must also make Point3D objects comparable to each other using the Comparable interface. 3-D points are compared by x-coordinate, then by y-coordinate, then by z-coordinate. In other words, a Point 3D object with a smaller x-coordinate is considered to be "less than" one with a larger x-coordinate. If two Point3D objects have the same x-coordinates, the one with the lower y-coordinate is considered "less". If they have the same x and y-coordinates, the one with the lower z-coordinate is considered "less". If the two points have the same x, y, and z-coordinates, they are considered to be "equal"

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:00
In addition to using the icons to adjust page margins, a user can also use
Answers: 1
question
Computers and Technology, 23.06.2019 00:10
My has been slow anyone else’s ?
Answers: 1
question
Computers and Technology, 23.06.2019 06:30
You are consulting for a beverage distributor who is interested in determining the benefits it could achieve from implementing new information systems. what will you advise as the first step?
Answers: 1
question
Computers and Technology, 23.06.2019 06:40
What are the three uses of a screw?
Answers: 2
You know the right answer?
You have been asked to extend the Point class that represents 2-D (x, y) coordinates. The Point clas...
Questions
question
Geography, 10.08.2021 21:50
question
English, 10.08.2021 21:50
Questions on the website: 13722363