felixyulin
May 18th, 2013, 06:43 AM
Hello, i'm new to Java.
I have encountered some errors when i tried to run this Java Program.. Did i do sth wrong in here?
Please help:(
import javax.swing.JOptionPane;
public class DebugTest
{
public static void main(String[] args)
{
int PIE = 3.14;
String radius = "";
double radius = 0.0;
double area = 0.0;
float circumference = 0.0;
radius = JOptionPane.showInputDialog("Enter the radius of
a circle to calculate the area: ");
radius = Double.parseDouble(radius);
area = Math.pow(2, radius) * PI;
JOptionPane.showMessageDialog(null, "The area of the
circle is: " + area);
circumference = Math.sqrt(area / PI) * PI * 2;
JOptionPane.showmessagedialog(null, "The circumference of
the circle is: " + circumference);
System.out.println("*** End of Processing ***");
}
}
I have encountered some errors when i tried to run this Java Program.. Did i do sth wrong in here?
Please help:(
import javax.swing.JOptionPane;
public class DebugTest
{
public static void main(String[] args)
{
int PIE = 3.14;
String radius = "";
double radius = 0.0;
double area = 0.0;
float circumference = 0.0;
radius = JOptionPane.showInputDialog("Enter the radius of
a circle to calculate the area: ");
radius = Double.parseDouble(radius);
area = Math.pow(2, radius) * PI;
JOptionPane.showMessageDialog(null, "The area of the
circle is: " + area);
circumference = Math.sqrt(area / PI) * PI * 2;
JOptionPane.showmessagedialog(null, "The circumference of
the circle is: " + circumference);
System.out.println("*** End of Processing ***");
}
}