Results 1 to 6 of 6
  1. #1
    seaisle68 is offline Member
    Join Date
    Apr 2011
    Posts
    2
    Rep Power
    0

    Default Modifying this app.

    please help me modify the circle class to include an overload constructor that accepts the radius of the Circle object..

    /**
    * Circle class.
    */
    public class Circle {
    private static final double PI= 3.14;
    private double radius;

    /**
    * constructor
    * pre: none
    * post: A circle object created. Radius initialized to 1.
    */
    public Circle() {
    radius = 1; //default radius
    }

    /**
    * Changes the radius of the circle.
    * pre: none
    * post: Radius has been changed.
    */
    public void setRadius (double newRadius) {
    radius = newRadius;
    }

    /**
    * Calculates the circumference of the circle
    * pre: none
    * post: The circumference of the circle has been returned.
    */
    public double circumference() {
    double circleCircumference;

    circleCircumference = 2 * PI * radius;
    return(circleCircumference);
    }

    /**
    * Returns the radius of the circle.
    * pre: none
    * post: The radius of the circle has been returned.
    */
    public double getRadius() {
    return(radius);
    }

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,988
    Rep Power
    9

    Default

    That's not really how this works. What have you tried? Why are you stuck? What worked, what didn't work? How didn't it work? Ask a specific question, and we'll go from there. This isn't a code service.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    We can't help you until you tell us specifically what problems you are having. Until then, the original post is not much more than a code/homework dump.

  4. #4
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default

    Two in a row, though.
    Will we get a hat-trick?

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,988
    Rep Power
    9

    Default

    Quote Originally Posted by Tolls View Post
    Two in a row, though.
    Will we get a hat-trick?
    We sure will.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default

    Quote Originally Posted by KevinWorkman View Post
    Hurrah!

    Though technically that's a different scorer...:)

Similar Threads

  1. Modifying output
    By sqlsql0 in forum New To Java
    Replies: 1
    Last Post: 02-28-2011, 11:33 AM
  2. Modifying Automato Code
    By whateverme in forum New To Java
    Replies: 0
    Last Post: 02-06-2011, 02:36 PM
  3. Need help modifying code for hex conversion
    By gamer765 in forum New To Java
    Replies: 14
    Last Post: 10-25-2010, 06:59 AM
  4. One Jspinner modifying the value of the other
    By cotarelo in forum AWT / Swing
    Replies: 1
    Last Post: 06-11-2010, 02:48 PM
  5. Modifying text file
    By right2001 in forum New To Java
    Replies: 7
    Last Post: 04-13-2009, 08:41 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •