// area1: David I. Schwartz 1/2000 // find area of circle public class area1 { public static void main(String[] args) { // Declare radius r and area A // A and r will store floating-point values double r; double A; // Assign a f-p value to r // Try other values, like -10. and "abc" to see what Java does r = 7.1; // If r is positive, compute area // Otherwise, exit from program if( r <= 7.1 ) { // Compute area of circle A = Math.PI*r*r; // Output area to screen System.out.println("The area is: " + A); } else { System.err.println("What kind of r was that?!?"); System.exit(0); // exit program } } } // Output: // The area is: 158.36768566746144