// package chapter6; /** * Title: Chapter 6, "Programming with Objects and Classes" * Description: Examples for Chapter 6 * Copyright: Copyright (c) 2000 * Company: Armstrong Atlantic State University * @author Y. Daniel Liang * @version 1.0 */ // CircleWithAccessors.java: The circle class with accessor methods public class CircleWithAccessors { private double radius; /**Default constructor*/ public CircleWithAccessors() { radius = 1.0; } /**Construct a circle with a specified radius*/ public CircleWithAccessors(double r) { radius = r; } /**Return radius*/ public double getRadius() { return radius; } /**Set a new radius*/ public void setRadius(double newRadius) { radius = newRadius; } /**Return the area of this circle*/ public double findArea() { return radius*radius*3.14159; } }