import javax.swing.JOptionPane;
public class ComputeArea4 {
public static void main(String[] args) {
final double PI = 3.14159;
double radius;
double area;
String areaStr;
String radiusStr = JOptionPane.showInputDialog(null,"Enter the radius: ");
radius = Double.parseDouble(radiusStr);
area = radius * radius * PI;
areaStr = String.format("%.2f", area);
JOptionPane.showMessageDialog(null, "The area for a circle with radius " +
radius + " is " + areaStr);
}
}
syntax highlighted by Code2HTML, v. 0.9.1