All pastes #624191 Raw Edit

Miscellany

public java v1 · immutable
·published 2007-07-18 02:52 UTC
rendered paste body
/* * Surface Area and Volume of Soda Can */import java.lang.Math;public class SodaCan {    private double height;    private double radius;    /*     * Constructs the soda can     * @param theHeight The Height     * @param theRadius The Radius     */    public SodaCan(double theHeight, double theRadius) {        this.height = theHeight;        this.radius = theRadius;    }    /*     * Returns surface area of soda can     * @return Surface Area of soda can     */    public double getSurfaceArea() {        return (2 * Math.PI * (this.radius * this.radius)) + (2 * Math.PI * this.radius * this.height);    }    /*     * Returns volume of Soda Can     * @return Volume of soda can     */    public double getVolume() {        return Math.PI * (this.radius * this.radius) * this.height;    }}