/*
 * Created on Nov 4, 2003
 * CS 108 
 * Section A
 */
package hotj.gui1;

/**
 * @author Eric Knibbe
 *
 * This Pie Slice class receives values for the radius and angle of a slice of 
 * a pie, and returns the area of a given slice. 
 */
/**
 * Encapsulates the attributes and actions of a slice of pie.
 */
public class PieSlice {

	/**
	 * The radius of the whole pie.
	 */
	private double myRadius;
	/**
	 * The angle of the slice.
	 */
	private double myAngle;

	/**
	 * Constructs a new slice of pie.
	 * @param radius the radius of the whole pie.
	 * @param angle the angle of this particular slice, measured in degrees.
	 */
	public PieSlice(double radius, double angle) {
		myRadius = radius;
		myAngle = angle;
	}

	/**
	 * Computes the area of the slice of pie.
	 * @return the area of the slice of pie.
	 */
	public double area() {
		double totalPieArea = Math.PI * myRadius * myRadius;
		return totalPieArea * myAngle / 360.0;
	}

}
