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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started