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.
- 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.
You'll get 1 file (6.0KB)