// Circle.java // Compute area and circumference of a Circle. // Author: R.N. Ciminero // Date: 04-13-96 public class Circle { double radius=0; // class fields double theArea, theCircumference; Circle ( double x ) { // constructor radius = x; } public void area(){ // compute the area theArea = radius * radius * 3.14159; } public void circumference(){ // compute the circumference theCircumference = 2.0*radius*3.14159; } public void printCircle(){ // display the area and circumference System.out.print("Area and Circumference of a Rectangle." + "\n"); System.out.print("Radius = " + radius + " "); System.out.print("Area = " + theArea + " "); System.out.print("Circumference = " + theCircumference + "\n"); } public static void main (String args[]) { Circle theCircle = new Circle(4.0); // instance of Circle theCircle.area(); theCircle.circumference(); theCircle.printCircle(); } }