( --> )

Cylinder Surface Area Program

 --> CylinderApp

 --> blue.shapes.*;

 -->

// Observe the given information
   double height = 12.5;
   double diameter = 2.25;

// Determine other relevant information
   double radius = diameter / 2.0;

// Create the top and the bottom
   Circle top = new Circle(radius);
   Circle bottom = new Circle(radius);

// Create the side
   double length = top.perimeter();
   Rectangle side = new Rectangle(height,length);

// Compute the result
   double surfaceArea = 
      top.area() + bottom.area() + side.area(); 

// Display the result
   IO.print("The surface area of the cylinder is ");
   IO.print(surfaceArea);
   IO.println(" square feet.");

 -->

   indigo> java CylinderApp
   The surface area of the cylinder is 96.3094 square feet.