/* * File: AreaOfCircle.java * --------------------- * This program prompts for the radius of a circle, * then prints the area of the circle. * * Author: CS1MD3, Sept. 2008 */ import acm.program.*; public class AreaOfCircle extends ConsoleProgram { public void run() { println("This program calculates the area of a circle."); double r = readDouble("Enter radius: "); //* Prompts for radius double a = PI*r*r; //* Computes the area by the formula println("The area of the circle is " + a + "."); } /* constant PI */ private static final double PI = 3.1415926535897932; }