title: Learning to build an object in Java
body: <p>Hello I'm having a little trouble in understanding this homework. I just started Java a few weeks ago and we just started on building classes so here is the question. </p>
  
  <p><strong>The problem</strong>: I'm having a trouble with the first constructor and setRadius I generally don't know what to do in them. Do I input into <code>setRadius</code> and send that value to that constructor. What do I do with the constructor?</p>
  
  <blockquote>
    <p>Write a Circle class that has the following fields:</p>
    
    <ul>
    <li><strong>radius</strong>:  a double</li>
    <li><strong>PI</strong>:  a final double initialized with the value 3.14159</li>
    </ul>
    
    <p>The class should have the following methods:</p>
    
    <ul>
    <li><strong>Constructor</strong>:  accepts the radius of the circle as an argument.</li>
    <li><strong>Constructor</strong>:  a no-arg constructor that sets the radius field to 0.0.</li>
    <li><strong>setRadius</strong>:  a mutator method for the radius field. </li>
    <li><strong>getRadius</strong>:  an accessor method for the radius field. </li>
    <li><strong>getArea</strong>:  returns the area of the circle, which is calculated as area = PI * radius * radius.</li>
    <li><strong>getDiameter</strong>:  returns the diameter of the circle, which is calculated as diameter = radius * 2. </li>
    <li><strong>getCircumference</strong>:  returns the circumference of the circle, which is calculated as circumference  = 2 * PI * radius.</li>
    </ul>
    
    <p>Write a program that demonstrates the Circle class by asking the user for the circle's radius, creating a Circle object, and then reporting the circle's area, diameter, and circumference.</p>
  </blockquote>
  
  <p>So I wrote this code:</p>
  
  <pre><code>public class CircleClass {
  
      final double PI = 3.14159;
      double radius;
  
      // this constructor allows the input of the user 
      public CircleClass (double rad){
          radius = rad;
      }
  
      // this is the default constructor in case of no user input
      public CircleClass (){
          radius = 0;
      }
  
      // this method allows you to set the radius
      public void setRadius (double input){
          //CircleClass input;
          radius = input;
      }
  
      // value returners //
  
      // returns radius
      public double getRadius (){
          return radius;
      }
  
      // returns area
      public double getArea (){
          return PI * radius * radius;
      }
  
      // returns diameter
      public double getDiameter(){
          return radius * 2;
      }
  
      // returns circumference 
      public double getCircumference(){
          return 2 * PI * radius;
      }
  
  }
  </code></pre>
  
  <p>So I'm confused as to the first method and also I may have made a mistake somewhere else in this program if you see something and you think I should know let me know please.</p>