// Arup Guha
// 4/10/07
// An edited version of Circle.java that illustrates exception propagation.

import java.util.*;

public class CircleExcptEx {

  	public static void main(String[] args) {

    	// Get size of radius from the user.
    	int radius=0;
    	boolean done = false;
    
    	while (!done) {
    
    		try {
    			radius = getInput();
    			done = true;
    		}
    		catch (InputMismatchException e) {
    			
    			// This is added to illustrate the method's behavior.
    			e.printStackTrace(); 
    			
    			System.out.println("Try entering an integer this time.");	
    		}
		}
	
    	// Compute and print out area.
    	double area = Math.PI*radius*radius;
    	System.out.print("The area of your pizza with radius "+radius);
    	System.out.println(" is "+area);

  	}
  
  	public static int getInput() throws InputMismatchException {
  		Scanner stdin = new Scanner(System.in);
  		System.out.println("What is the radius of your pizza?");
    	return stdin.nextInt();
  	}
  	
}