Question: in java please In a package called shape, create a Sphere class and a Sphere Driver Class. Your Sphere Driver should demonstrate creating a Sphere
in java please
In a package called shape, create a Sphere class and a Sphere Driver Class. Your Sphere Driver should demonstrate creating a Sphere object and using it to invoke the Sphere methods. Your Sphere class should have the following: Class variable diameter that has a private visibility A constructor without parameters that sets diameter to a default of 1 A setDiameter(int diameter) method that sets the parameter's diameter to the classes diameter (you must you this) A getDiameter() method that returns the diameter AgetVolume() method that return the volume of a sphere A getSurfaceArea() method that return the surface area of a sphere AtoString method that returns a string representation of the Sphere. You should round to the second decimal place. Ex: A sphere with a diameter of 4 has a volume of 33.51 and a surface area of 50.27 Submit you Sphere.java file for grading
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
