Question: How do I correctly call the superclass(Point2D) in Point3D? As of right not I get a compilation error saying that the x and y are

How do I correctly call the superclass(Point2D) in Point3D? As of right not I get a compilation error saying that the "x" and "y" are private access to Point2D. I believe I need something like this... String superString = super.toString( ); ----- but where would this go and how would I correctly use it to pull the x and y values for my Point3D class. Thanks for the help!

How do I correctly call the superclass(Point2D) in Point3D? As of right

not I get a compilation error saying that the "x" and "y"

public class Point3D extends Point2D { private int z = 0; * Default constructor, initializes all points to zero. public Point3D() { super(); z = 0; } /** * Constructor that sets up the values to be used correctly with the * Point 2D data. * @param x this is the number for the x spot in the point. * @param y this is the number for the y spot in the point. * @param z this is the number for the z spot in the point. */ public Point3D(int x, int y, int z) { super(x, y); this.Z = z; } 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 - 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 p 50 51 52 53 54 55 E 56 57 58 59 60 61 62 63 64 65 * Allows access to the 3D point z coordinate value * @return the 3D point z coordinate value */ public int getz) { return z; } /** * Allows setting the 3D point z coordinate value @param z the updated 3D point z coordinate value */ public void setz(int z) { this.Z = z; } * Converts a 3D point object into a string representation in this format: * (x, y, z) * @return a string reference for a 3D point object */ @Override public String toString() { return "(" + super.x + ", + super.y + ", " + this.z + ")"; } 67 11 69 /** * Tests two 3D point objects for equality 70 71 72 73 74 75 76 77 78 * @param obj the right operand object ("this" is the left operand) * @return true is the two 3D points are equal, false otherwise */ @Override /** * Constructor that allows assigning the x and y values for the 2D point @param x the 2D point x coordinate value * @param y the 2D point y coordinate value */ public Point2D(int x, int y) { this. = x; this.y = y; } /** * Allows access to the 2D point x coordinate value * @return the 2D point x coordinate value */ public int getX() { return; } * Allows access to the 2D point y coordinate value * @return the 2D point y coordinate value 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 public int getY() { return y; } * Allows setting the 2D point x coordinate value * @param x the updated 2D point x coordinate value */ public void setx(int x) { { this. = x; } * Allows setting the 2D point y coordinate value * @param y the updated 2D point y coordinate value */ public void setY(int y) { this.y = y; } /** * Converts a 2D point object into a string representation in this format: * (x, y) * @return a string reference for a 2D point object */ @Override public String toString() { return "(" + + ", " + y + ")"; } 97 0 98 99 100 101 102 103 /** * Tests two 2D point objects for equality *

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!