Question: 2. Given: public class Point public Point (double xx, double yy, double zz) x xx ; public double getX) return xi public double getY) return

2. Given: public class Point public Point (double xx, double yy, double zz) x xx ; public double getX) return xi public double getY) return y: public double getz) return z; public double distance (Point p) return Math.sqrt ((x - p.x)* (x - p.x) private double x, y, z; public class Sphere public Sphere (Point cntr, double rad) center = cntr; radius -rad; public Point getCenter () return center public double getRadius ) return radius; private Point center; private double radius a. Write toString) and equals0 methods for class Sphere. Test your methods, in a driver program, by creating two separate Spheres with two separate centers at 1,2,3) each with a radius of 5 b. Explain how to determine if objects are equal. Next, show that neither the centers nor the spheres are .=-, but that they are equals0. Finally, use toString0 to output the salient properties of one of the Spheres. c. Create a derived class, VSphere which includes a method to calculate the volume of a sphere; write a test driver&test it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
