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 13:20
Raymond ozzie, the software designer who was critical in the development of lotus notes, was able to dictate the terms under which ibm acquired lotus. this illustrates that he had bargaining power based on the cost required by the firm to replace him.
Answers: 3
question
Computers and Technology, 22.06.2019 01:00
)a grad student comes up with the following algorithm to sort an array a[1..n] that works by first sorting the first 2/3rds of the array, then sorting the last 2/3rds of the (resulting) array, and finally sorting the first 2/3rds of the new array. 1: function g-sort(a, n) . takes as input an array of n numbers, a[1..n] 2: g-sort-recurse(a, 1, n) 3: end function 4: function g-sort-recurse(a, `, u) 5: if u ⒠` ≤ 0 then 6: return . 1 or fewer elements already sorted 7: else if u ⒠` = 1 then . 2 elements 8: if a[u] < a[`] then . swap values 9: temp ↠a[u] 10: a[u] ↠a[`] 11: a[`] ↠temp 12: end if 13: else . 3 or more elements 14: size ↠u ⒠` + 1 15: twothirds ↠d(2 ◠size)/3e 16: g-sort-recurse(a, `, ` + twothirds ⒠1) 17: g-sort-recurse(a, u ⒠twothirds + 1, u) 18: g-sort-recurse(a, `, ` + twothirds ⒠1) 19: end if 20: end function first (5 pts), prove that the algorithm correctly sorts the numbers in the array (in increasing order). after showing that it correctly sorts 1 and 2 element intervals, you may make the (incorrect) assumption that the number of elements being passed to g-sort-recurse is always a multiple of 3 to simplify the notation (and drop the floors/ceilings).
Answers: 3
question
Computers and Technology, 22.06.2019 23:30
Creating "smart interfaces" in all sectors of industry, government, and the public arena is one of the fastest growing hct areas. these interfaces model, interpret, and analyze such human characteristics as speech, gesture, and vision. the field of biometrics, in which humans authenticate themselves to machines, is an area of considerable interest to hct practitioners. fingerprint scans are one of the most frequently used biometric options, and this article, biometric student identification: practical solutions for accountability & security in schools, makes a case for the implementation of fingerprint scans in schools. critique the article, and answer the following questions: according to the author, what are the main benefits of adopting fingerprint scans in schools for student identification? according to the author, what are the main drawbacks of adopting fingerprint scans in schools for student identification? do you agree with the author's assessment of the pl
Answers: 2
question
Computers and Technology, 23.06.2019 03:00
State 7 common key's for every keyboard
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
Mathematics, 17.03.2021 23:40
question
Mathematics, 17.03.2021 23:40
Questions on the website: 13722359