title: why is my setter and getter methods not working?
body: <p>I have been looking at my source code and can't figure out what is wrong with it.
  The problem I think is with the Circle class. When I call the mutators and accessors from
  the DriverCircle class it's giving me the wrong output. For getDiameter it's just printing out 0s. </p>
  
  <pre><code>public class Circle{
      private double radius;  
      private double pi;
      private double diameter;
      private double circumference;
      private double area; 
  
      public Circle(){
          pi = Math.PI;
          radius = 0;
      }
  
      public Circle(double radius){
          this.radius = radius;
      }
      public void setDiameter(){
          diameter = (2 * radius);
      }
      public double getDiameter(){
          //diameter = 2 * radius;
          return diameter;
      }
      public void setCircumference(){
          circumference = (2 * pi * radius);
      }
      public double getCircumference(){
          //circumference = 2 * pi * radius;
          return circumference;
      }
      public double getArea(){
          //area = pi * Math.pow(radius, 2);
          return area;
      }
      public void setArea(){
          area = (pi * Math.pow(radius, 2));
      }
      public void setRadius(double radius){
          this.radius = radius;
      }
      public double getRadius(){
          return radius;
      }
      public String toString(){
          return "The radius is " + radius;
      }
  }
  </code></pre>
  
  <hr>
  
  <p>(The tester)...</p>
  
  <pre><code>import java.util.Scanner;
  
  public class CircleDriver {
  
      public static void main(String[] args) {
  
          Scanner input = new Scanner(System.in);
          System.out.println("Please enter the radius: ");
          Circle[] circles = new Circle[10];
          Circle objectCircle = new Circle();
          objectCircle.setRadius(input.nextDouble());
  
  
          circles[1] = new Circle();
          circles[2] = new Circle(2.0);
          circles[3] = new Circle(3.5);
          circles[4] = new Circle(5.0);
          circles[5] = new Circle(0.0);
          circles[6] = new Circle(15);
          circles[7] = new Circle(25);
          circles[8] = new Circle(-7);
          circles[9] = new Circle(-10.0);
  
          System.out.println("Initial call to toString():");
          for (Circle c : circles)
              {System.out.println("\t" + c);}
  
          System.out.println("Call to getRadius (should be same as above):");
          for (Circle r : circles)
              {if (r != null)
                  {System.out.println("\t" + r.getRadius());}}
  
          System.out.println("Call to getDiameter (should be twice the value shown above):");
          for (Circle d : circles)
              {if (d != null)
                  {System.out.println("\t" + d.getDiameter());}}
  
          System.out.println("Calls to getCircumference:");
          System.out.println("\tShould be 2 * PI:  " + circles[1].getCircumference());
          System.out.println("\tShould be 0.0:  " + circles[5].getCircumference());
  
          System.out.println("\nCall to getArea:");
          System.out.println("\tShould be PI:  " + circles[1].getArea());
          System.out.println("\tShould be 0.0:  " + circles[5].getArea());
  
          System.out.println("Testing out the setRadius method:");
          for (int i = 0; i &lt; circles.length / 2; i++)
              {if (circles[i] != null)
                  {circles[i].setRadius(i);}}
  
          System.out.println("Call to toString after setting the first half of the objects:");
          for (Circle c : circles)
              {System.out.println("\t" + c);}
      }
  }
  </code></pre>