SHARE
TWEET

Untitled

advictoriam Jan 31st, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Box
  2. {
  3.    private double height;
  4.    private double width;
  5.    private double depth;
  6.  
  7.    /**
  8.       Constructs a box with a given side length.
  9.       @param sideLength the length of each side
  10.    */  
  11.    public Box(double h, double w, double d)
  12.    {
  13.       height = h;
  14.       width = w;
  15.       depth = d;
  16.    }
  17.  
  18.    /**
  19.       Gets the volume of this box.
  20.       @return the volume
  21.    */
  22.    public double volume()
  23.    {
  24.       return height * width * depth;
  25.    }
  26.    
  27.    /**
  28.       Gets the surface area of this box.
  29.       @return the surface area
  30.    */
  31.    public double surfaceArea()
  32.    {
  33.       return 2*(height*width)+2*(height*depth)+2*(width*depth);
  34.    }
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top