Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions