Lab 3

Write a Java class named "Circle" that models a circle. Your class should have only one instance variable; the radius of the circle.

Your class should include the following methods

Your class file should include appropriate documentation comments for the class as a whole and for each method. The Java class implementation is worth 10 points and appropriate documentation comments are worth an additional 5 points.

Geometric Formulas

diameter = 2.0 * radius
circumference = 2.0 * π * radius
area = π * radius2

Use Math.PI as the value of π

The value of π is defined as a constant (named PI) in the Math class. Class constants are accessed by specifying the name of the class followed by a period followed by the name of the constant (ClassName.ConstantName). In Java the value of  π is given by Math.PI.

Use the Math.pow Function to Perform Exponentiation

There is no exponentiation operator in Java. However, there is a function named "pow" in the Math class that performs exponentiation. It has two double arguments and returns the value obtained by raising the first argument to the power of the second argument. For example, Math.pow(a, b) returns the value of ab where a and b are double values.

Submitting Your Work

Send me your "Circle.java" file as an attachment to an email message whose subject is "Lab03".