Write the classes as shown in the following class diagram. Mark all the overridden methods with annotation @Override. ExerciseOOP_Point2DPoint3D.png
Hints:
You cannot assign floating-point literal say 1.1 (which is a double) to a float variable, you need to add a suffix f, e.g. 0.0f, 1.1f.
The instance variables x and y are private in Point2D and cannot be accessed directly in the subclass Point3D. You need to access via the public getters and setters. For example,
public void setXYZ(float x, float y, float z) {
setX(x); // or super.setX(x), use setter in superclass
setY(y);
this.z = z;
}
The method getXY() shall return a float array:
public float[] getXY() {
float[] result = new float[2]; // construct an array of 2 elements
result[0] = ...
result[1] = ...
return result; // return the array