I have written a class for, as the title says, points in the three-dimensional space.
import java.awt.Point; public class Point3d extends Point{ public Point3d(int x, int y, int z){ } public static double distance (double X1, double Y1, double Z1, double X2, double Y2, double Z2){ double distance; distance = Math.sqrt(Math.pow((X1-X2), 2) + Math.pow((Y1-Y2), 2) + Math.pow((Z1-Z2), 2)); return distance; } }
I've tested the distance()-method just by calling it (without creating an instance of Point3d, that is) and it worked as intended.
The instructions to this assignment states that Point3d is to, apart from handle coordinates in 3d, be able to store x-,y- and z-coordinates and calculate the distance between two points by overriding the distance()-method in the superclass.
My tutor told me that I still have some things to take care of, leaving me with the advice "Take a look at the superclass".
Well, I have tried but failed to find what's "wrong" with my class or what it's lacking. (Quotation marks on wrong since it worked when I tried it).
Point2d: Java 2 Platform SE v1.3.1: Class Point2D
Point: Java 2 Platform SE v1.3.1: Class Point
Thanks in advance for any help.