/******************************* MAIN HEADER **********************************
    Title:       Cylinder Volume, version 1
    File:        CylinderVolume1.java
    
    Author:      James D. Skrentny, skrentny@cs.wisc.edu
                 copyright 2000 all rights reserved
    Course:      CS 302: Lectures 1 & 2
    
    Compiler:    CodeWarrior IDE 4.0 (JDK 1.2)
    Platform:    Windows NT 4.0
 **************************** 80 columns wide *********************************/

/**
 * This program calculates the volume of a cylinder of radius 11 and height 15.
 *
 * Bugs: none known
 **/

/*
 * The approach shown below is inflexible since it requires the source file to
 * be edited and recompiled to be able to calculate volumes for cylinders of
 * different sizes.  There's a better approach.  See Cylinder Volume version 2.
 */

class CylinderVolume1 {

    public static void main(String[] args) {

        // declare variables and set initial values
        int    radius = 11, height = 15;  // sizes are "hardcoded"
        double volume = 0.0;

        // calculate the volume
        volume = Math.PI * Math.pow(radius, 2) * height;

        // display the result in the console window
        System.out.print  ("A cylinder of height 15 centimeters");
        System.out.print  (" and radius 11 centimeters");
        System.out.print  (" has a volume of " + volume);
        System.out.println(" centimeters cubed.");
    }

}
