Question: Ch 5 - You Do It Activity 4: The Sphere Class: UML Diagram Sphere private double radius //radius of the sphere private static int numSpheres

Ch 5 - You Do It Activity 4: The Sphere Class: UML Diagram

Sphere private double radius //radius of the sphere private static int numSpheres //static or class variable. All Sphere objects share it

public Sphere() //constructor . Initialize Sphere objects' instance variable radius to 0.0 public Sphere(double radius); // overloaded constructor. Initialize Sphere object's instance variable radius public void setRadius(double radius) //sets Sphere objects' instance variable radius public double getRadius() // returns the value of the Sphere objects' instance variable radius public double calculateVolume() //computes and returns the volume of the Sphere object public double calculateArea() //computes and returns the area of the Sphere object public double calculateDiameter() //computes and returns the diameter of the Sphere object public static int getNumSpheres() //returns the number of sphere objects public String toString() // returns a String representation of the Sphere object

Rewrite the Sphere class Diagram above to a UML(Unified Modelling Language) diagram. Three rectangles are already drawn for you for convenience on the next page.

Sphere

- radius : double - numSpheres

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!