Anele Skhosana 220049255 Question 2 Public class Point3D extends Point{ public double z; public Point3D(){ this.z =0.0; } public Point3D(double x,double y,double z){ super(x,y); this.z = z; } public double getZ(){ return z; } Public void setZ(double z){ this.z = z; } public String toString(){ return”(“+super.getX() + ”,” + super.getY() + “,” + z +”)”; } public double distance(point p){ return (int)Math.sqrt(Math.pow(p.getX() - getX(), 2)+ Math.pow(p.getY()getY(),2)+Math.pow(((Point3D)p).z - this.getZ(),2)); } public boolean equals(Object o){ if (o instanceof Point3D ){ Point3D p = ((Point3D)o); if(p.z == this.z && p.getX() == this.getX() & p.getY() == this.getY()) return true; else return false; } else0 return false; } }