Results 1 to 6 of 6
Thread: Modifying this app.
- 04-07-2011, 02:31 PM #1
Member
- Join Date
- Apr 2011
- Posts
- 2
- Rep Power
- 0
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);
}
- 04-07-2011, 02:36 PM #2
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!
-
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.
- 04-07-2011, 02:45 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Two in a row, though.
Will we get a hat-trick?
- 04-07-2011, 03:07 PM #5
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 04-07-2011, 03:12 PM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Similar Threads
-
Modifying output
By sqlsql0 in forum New To JavaReplies: 1Last Post: 02-28-2011, 11:33 AM -
Modifying Automato Code
By whateverme in forum New To JavaReplies: 0Last Post: 02-06-2011, 02:36 PM -
Need help modifying code for hex conversion
By gamer765 in forum New To JavaReplies: 14Last Post: 10-25-2010, 06:59 AM -
One Jspinner modifying the value of the other
By cotarelo in forum AWT / SwingReplies: 1Last Post: 06-11-2010, 02:48 PM -
Modifying text file
By right2001 in forum New To JavaReplies: 7Last Post: 04-13-2009, 08:41 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks