// Guide to Java
// Copyright 2014, by J.T. Streib and T. Soma

// a program to calculate the area of a circle

import java.util.*;

class CalcAreaCircle {
public static void main(String[] args) {        
   // declaration and initialization of variables
   double radius;
   Circle circle;        
   Scanner scanner;
   circle = new Circle();
   scanner = new Scanner(System.in);
   // input radius
   System.out.print("Enter the radius: ");
   radius = scanner.nextDouble();
   circle.setRadius(radius);
   // compute and output the area of the circle
   System.out.println();
   System.out.print("The area of the circle with a radius of");
   System.out.printf(" %.2f cm is %.2f", radius, circle.computeArea());
   System.out.println(" square cm.");
}
}

// definition of Circle class
class Circle {
// data member
private double radius;

// constructor
public Circle() {  
   radius = 0.0;
}

// mutator method
public void setRadius(double inRadius) {
   radius = inRadius;
}

// method to calculate the area of the circle
public double computeArea() {
   return Math.PI * Math.pow(radius,2);
}

// accessor method
public double getRadius() {
   return radius;
}
}