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 16:50
3.2.5 suppose that we have an estimate ahead of time of how often search keys are to be accessed in a bst, and the freedom to insert items in any order that we desire. should the keys be inserted into the tree in increasing order, decreasing order of likely frequency of access, or some other order? explain your answer.
Answers: 1
question
Computers and Technology, 21.06.2019 20:30
Write a program that reads the file, then displays the average number of steps taken for each month. (the data is from a year that was not a leap year, so february has 28 days.) your program needs to use at least 3 functions not counting main and display the information in a neat well formatted fashion.
Answers: 3
question
Computers and Technology, 23.06.2019 09:00
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
question
Computers and Technology, 24.06.2019 22:00
Difference between ancient and modern mode of information transmission
Answers: 1
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
Spanish, 12.03.2020 00:26