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
    4,038
    Rep Power
    10

    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,315
    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 offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    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
    4,038
    Rep Power
    10

    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 offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    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, 12:33 PM
  2. Modifying Automato Code
    By whateverme in forum New To Java
    Replies: 0
    Last Post: 02-06-2011, 03:36 PM
  3. Need help modifying code for hex conversion
    By gamer765 in forum New To Java
    Replies: 14
    Last Post: 10-25-2010, 07:59 AM
  4. One Jspinner modifying the value of the other
    By cotarelo in forum AWT / Swing
    Replies: 1
    Last Post: 06-11-2010, 03:48 PM
  5. Modifying text file
    By right2001 in forum New To Java
    Replies: 7
    Last Post: 04-13-2009, 09: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
  •