title: Decimal Formatting for Static Methods
body: <p>Edit: The book has a typo with cylinder and used volume instead, but the point of the program is to exercise working with static methods so it doesn't matter.</p>
  
  <p>I finished this program and got it working to get the static methods to interact with my main class. I'm just having an issue with decimal formatting. I get 11 decimal places with the doubles. I've tried using DecimalFormat, but that doesn't have any affect, no matter where I put it. Do I need to do something extra because of working with static methods now?</p>
  
  <pre><code>import java.text.DecimalFormat; //import DecimalFormat
  
  class Area{
  
      //Area of a Circle
      static double Area(double radius){
          return Math.PI * (radius * radius);
      }
  
      //Area of a Rectangle
      static int Area(int width, int length){
          return width * length;
      }
  
      //Volume of a Cyclinder
      static double Area(double radius, double height){
          return Math.PI * (radius * radius) * height;
      }
  }
  
  public class AreaDemo{
      public static void main(String[] args){
  
          //Variable Declarations for each shape
          double circleRadius = 20.0;
          int rectangleLength = 10;
          int rectangleWidth = 20;
          double cylinderRadius = 10.0;
          double cylinderHeight = 15.0;
  
          //Print Statements for the Areas
          System.out.println("The area of a circle with a radius of " + circleRadius + " is " + Area.Area(circleRadius)); //Circle
          System.out.println("The area of a rectangle with a length of " + rectangleLength + " width of " + rectangleWidth + " is " + Area.Area(rectangleLength, rectangleWidth)); //Rectangle
          System.out.println("The area of a cylinder with radius " + cylinderRadius + " and height " + cylinderHeight + " is " + Area.Area(cylinderRadius, cylinderHeight)); //Cylinder
      }
  }
  </code></pre>