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
158
160
Ответы на вопрос:
Популярно: Информатика
-
криссть11101.09.2020 23:44
-
clen1clenom21.06.2022 14:29
-
abdylaevapatima16.07.2020 23:03
-
artikiv200624.09.2021 16:56
-
Лисоооооооо03.11.2020 04:53
-
алишер12619.02.2020 14:54
-
Лиза10987654325.08.2021 06:44
-
элианора12321.04.2023 15:33
-
alinasupieva091022.02.2021 00:04
-
Boevoy200231.05.2020 07:11