Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java! please help!!1

843789Feb 19 2010 — edited Feb 19 2010
I am having problem with find the circumferene, i have t use 2*Maths.PI*r but i dont where i should put these.

import javax.swing.JOptionPane;

public class CircumferenceSwing
{
public static void main(String[] args)
{
// declare variables
String radius,
int 2, Math.PI
double circumference, index;

// prompts and get input
System.out.println("\tWelcome to My Circumference Console Calculator");
radius = JOptionPane.showInputDialog(null, "Enter the radius:");
Math.PI = Integer.parseInt(radius);

// calculations
Math.PI = PI / 3.14
index = circumference / Math.pow(Math.PI*r, 2);

// output
JOptionPane.showMessageDialog(null, "The result of the radius is " +
Math.round(index) + ".", "Radius Calculator", JOptionPane.PLAIN_MESSAGE);
}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 19 2010
Added on Feb 19 2010
17 comments
119 views