Computers and Technology

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"

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 16:00, alyssatamayo641
Speed is how fast an object moves a certain distance within a length of time. how is speed calculated? a) distance/time b) time/distance c) velocity/time d) distance x time
Answers: 1
image
Computers and Technology, 22.06.2019 15:00, gmc2771
Hyperactive media sales has 10 windows 7 laptop computers used by sales-people in the organization. each laptop computer has several customized applications that are used during the sales process as well as customer relationship management software. all of the applications on the laptops are difficult to configure and have large data files. if all of the laptops have current hardware, what is the easiest way to install windows 10 on them?
Answers: 1
image
Computers and Technology, 22.06.2019 17:30, babyface1686
How do you make a lenny face? plz, brailiest to who can answer first.
Answers: 1
image
Computers and Technology, 22.06.2019 20:10, yqui8767
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
Do you know the correct answer?
You have been asked to extend the Point class that represents 2-D (x, y) coordinates. The Point clas...

Questions in other subjects:

Konu
Chemistry, 21.10.2020 01:01
Konu
Mathematics, 21.10.2020 01:01
Konu
Mathematics, 21.10.2020 01:01