// Fig. 7.7: Test.java // Applet to test class Circle import java.awt.Graphics; import java.applet.Applet; import java.text.DecimalFormat; import com.deitel.jhtp2.ch07.Circle; public class Test extends Applet { private Circle c; public void init() { c = new Circle( 2.5, 37, 43 ); } public void paint( Graphics g ) { DecimalFormat precision2 = new DecimalFormat( "#.00" ); g.drawString( "X coordinate is " + c.getX(), 25, 25 ); g.drawString( "Y coordinate is " + c.getY(), 25, 40 ); g.drawString( "Radius is " + c.getRadius(), 25, 55 ); c.setRadius( 4.25 ); c.setPoint( 2, 2 ); g.drawString( "The new location and radius of c are ", 25, 85 ); g.drawString( c.toString(), 40, 100 ); g.drawString( "Area is " + precision2.format( c.area() ), 25, 115 ); } }