Methods for Area and Circumference of a Circle
Working With Circles.
Much of what is of interest with
respect to circles can be determined if the radius is known. This
Java applet will compute the
We will develop a method to compute each of these that is passed the radius as input. This first set of code is the program for CircleInfo.java. |
import java.awt.Container; import javax.swing.*; public class CircleInfo extends JApplet {
} |
Before we discuss the program you should develop the HTML file called CircleInfo.html. |
<html> <applet code="CircleInfo.class" width=300 height=150> </applet> </html> |
The results of the program look like the following when computing the area and circumference of a circle with radius 5.40. |
The code can be described as the following.
Make sure to notice that our methods are all delimited the same way. |