# Area and Circumference of the Circle Using JOptionPane in Java ``` Machine Problem

Write a program that input from the user the radius of a circle as an integer and prints the circle's circumference and area using the predefined constant Math.PI.

Use the following formulas (r is the radius):

circumference = 2 PI r

area = PI r 2

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My mobile number here in the Philippines is 09173084360.

=================================================

Want to support my channel?

GCash Account

09173084360

Paypal

Patreon

Thank you very much for your support.

```
``````/* Write a program that input from the user the radius of a circle
as an integer and prints the circle's circumference and area
using the predefined constant Math.PI.

Use the following formulas (r is the radius):
circumference = 2 PI r
area = PI r 2
*
*/

import javax.swing.JOptionPane;
import java.text.DecimalFormat;
import java.lang.Math;

public class Area_Circle {

private static final DecimalFormat df = new DecimalFormat("0.00");

public static void main(String[] args) {
// TODO Auto-generated method stub

// TODO Auto-generated method stub
String r =

JOptionPane.showInputDialog( "Enter the radius of the circle:  " );
double radius = Double.parseDouble(r);

double circumference= Math.PI * 2*radius;

JOptionPane.showMessageDialog( null,  "The Area of the Circle :  " + df.format(area) + "\n"
+ "The Circumference of the Circle :  " + df.format(circumference)
, "The Result", JOptionPane.INFORMATION_MESSAGE );

}

}
``````