xaxtusgod
07.03.2020 •
Computers and Technology
Design and implement a class called Sphere that contains instance data that represent the sphere’s diameter. Define the Sphere constructor to accept and initialize the diameter, and include getter and setter methods for the diameter. Include methods that calculate and return the volume and surface area of the sphere (see Programming Project 3.5 for the formulas). Include a toString method that returns a one-line description of the sphere. Create a driver class called MultiSphere, whose main method instantiates and updates several Sphere objects.
Solved
Show answers
More tips
- S Style and Beauty How to Get Rid of a Double Chin?...
- F Food and Cooking How to Cook Julienne? Recipes and Tips...
- D Dating, Love, Relationships 10 Useful Tips on How to Survive a Breakup?...
- F Food and Cooking Apple Cider Vinegar: The Ultimate Health and Beauty Solution...
- C Computers and Internet Е-head: How it Simplifies Life for Users?...
- F Family and Home How to Choose the Best Diapers for Your Baby?...
- F Family and Home Parquet or laminate, which is better?...
- L Leisure and Entertainment How to Properly Wind Fishing Line onto a Reel?...
- L Leisure and Entertainment How to Make a Paper Boat in Simple Steps...
- T Travel and tourism Maldives Adventures: What is the Best Season to Visit the Luxurious Beaches?...
Answers on questions: Computers and Technology
- M Mathematics Lisa is conducting an experiment which involves rolling a pair of number cubes numbered from 1 through 6. Rolling the sum of 12 is predicted to occur only 1 out of every...
- M Mathematics Reflection across the y-axis followed by a vertical shift 3 units up...
- M Mathematics Give the slope of a line perpendicular to the given line. 6x+3y=18...
Ответ:
Import java.awt.*;
import java.util.*;
public class Sprhere
{// Instance Data private double surfaceA, volume, r, diameter; //Constructors public Sphere ()
{r = 0;diameter = 0; surfaceA = 0;volume = 0;}
public Sphere (double radius, double d, double SA, double v)
{this. r = radius; this. diameter = d; this. surfaceA = SA;this.volume = v;}
//// Accesors.//public double get Radius()
{return r;}
public double get Diameter()
{return diameter;}
public double get SurfaceA()
{return surfaceA;}
public double get Volume()
{return volume;}
//// Mutators.//
Ответ: