/**
 * Cylinder models the cylinder shape.
 */
public class Cylinder {

    // Instance variables to represent characteristics of a cylinder
    private int radius;
    private int height;
    private String colour;

    /**
     * Initialize this Cylinder object to have a radius of 'r',
     * a height of 'h', and to be the colour 'c'.
     */
    public void init (int r, int h, String c) {
        radius = r;
        height = h;
        colour = c;
    }

    /**
     * Set the colour of this Cylinder object to the colour 'c'.
     */
    public void setColour (String c) {
        colour = c;
    }

    /**
     * Multiply the radius of this Cylinder object by 'rScale'.
     */
    public void scale (int rScale) {
        radius = radius*rScale;
    }

    /**
     * Multiply the radius of this Cylinder object by 'rScale' and the
     * height of this Cylinder object by 'hScale'.
     */
    public void scale (int rScale, int hScale) {
        radius = radius*rScale;
        height = height*hScale;
    }

    /**
     * Shrink this Cylinder object by dividing the radius by 'rScale'
     * and subtracting 'rDecrement' from the radius.  Also divide
     * the height by 'hScale' and subtract 'hDecrement' from it.
     */
    public void shrink (int rScale, int rDecrement,
                        int hScale, int hDecrement) {
        radius = radius/rScale - rDecrement;
        height = height/hScale - hDecrement;
    }

    /**
     * Calculate and return the volume of this Cylinder object.
     */
    public double volume () {
        return Math.PI*radius*radius*height;
    }

    /**
     * Return information about the dimensions of this Cylinder object.
     */
    public String getInfo () {
        return "Shape: Cylinder  Radius: " + radius + "  Height: " + height;
    }
}

