/* * Main.java * * Created on July 9, 2007, 12:25 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package javaapplication1; import java.io.*; /** * * @author smting */ public class Main { /** Creates a new instance of Main */ public Main() { } /** * @param args the command line arguments */ public static void main(String[] args) { //declare the variables double radius; double area; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str = ""; // Prompt the user to enter radius System.out.println("Enter radius: "); // Get the string from the keyboard try { str = br.readLine(); } catch (IOException ex) { System.out.println(ex); } //assign value to variable radius = Double.parseDouble(str); //radius = 4; // Compute area area = radius * radius * 3.14159; // Display results System.out.println("The area for the circle of radius " + radius + " is " + area); } }