these are the instructions that i was given
Write a program that calculates the area of a circle from its radius. The radius will be an integer entered via the keyboard.
Use this formula : area = PI * radius2
You will need to use the constant PI which you get by using Math.PI
A sample run would look like this :
Enter radius : 3
The radius is : 3
The area is : 28.274333882308138
when i try to run the program nothing happens??
cross posted, thanks
can someone tell me if my program looks right?? - Java Forums
import java.util.Scanner; public class Assign1_Roberts{ public static void main(String[]args){ Scanner input = new Scanner(System.in); //Prompt the user for input final double PI = 3.14159;//Declare a constant //Assign a radius double radius = input.nextInt(); //Compute area double area = radius * radius * PI; System.out.println("Enter radius :" + input.nextInt()); System.out.println("The radius is : " + radius); System.out.println("The area is: " + area); } }