I'm also working on a circle program, and have gotten the error down to just three errors. Please look at my code and the error and see if you can help me with what I need to do to fix it. Thanks for you help.
Here are the instructions:
Write Circle class that has only 2 static methods, area
and perimeter. Create TestCircle class with main method to
test Circle class. Use the Math.PI constant to calculate the
area and perimeter.
The Circle class has the following methods:
/**
* Class to calculate area and perimeter of circle.
*/
public class Circle {
/** Calculate area of circle.
* @param radius The radius of circle.
*/
public static double area(double radius);
/** Calculate perimeter of circle.
* @param radius The radius of circle.
*/
public static double perimeter(double radius);
}
______________________End of Instructions
End Circle.java
End TestCircle.java
Here are the errors that I'm getting.
C:\myjava\assignment2\problem4>javac Circle.java
Circle.java:17: variable area might not have been initialized
double area = area;
^
Circle.java:18: variable perimeter might not have been initialized
double perimeter = perimeter;
^
Circle.java:19: variable radius might not have been initialized
double radius = radius;
^
3 errors
------------------
[This message has been edited by Dianne Calhoun (edited September 30, 2001).]