Starting from:

$24

Point3D

Task 2 Value: 10 marks For this task you will create a Point3D class to represent a point that has coordinates in three dimensions labeled x, y and z. You will then use the class to perform some calculations on an array of these points. The Point3D class will have the following state and functionality:
Three fields, x, y and z, of type double, represent the point’s coordinates.
A no-arg constructor creates a point at position (0, 0, 0).
Another constructor creates a point with specified coordinates.
A getter method is provided for each of the fields.
An accessor method named distance returns the distance between the current point and another point passed as an argument.
The distance method is overloaded to accept the coordinates of the other point.
Write a TestPoint3D class that will have a main method, and perhaps other methods as required by good design, to test your Point3D class. It will not have user input because this class will stand as a record of the tests you have applied and you will be able to run it whenever you alter your Point3D class. The test class should contain the following:
Test the basic state and functionality of the Point3D class. Each of the constructors and each of the methods should be tested using some different data values. The test code should display values so that they can be checked.
Write some code to create an array of at least 10 Point3D objects.
Write a method max, which will accept the array of points as an argument, and will calculate and display the maximum distance between the points in the array, and the pair of points for which the maximum occurs.
Write a method min, which will accept the array of points as an argument, and will calculate and display the minimum distance between the points in the array, and the pair of points for which the minimum occurs.
Material to submit The material to submit for each task is described in the section Assessment Information in this Subject Outline, under the heading Presentation.

More products