import awb.*; import java.awt.*; public class Numbers extends java.applet.Applet { TextField instruct, result, mRadius, mLength; DoubleField gRadius, gLength; Button Compute; String sFirst, sMid, sLast, sInit, sFull; double radius, length, cylVol, pi=3.14159265; public void init () { instruct = new TextField(72); instruct.setText("Please enter radius and length below."); mRadius = new TextField(9); mRadius.setText("radius:"); mLength = new TextField(9); mLength.setText("length:"); gRadius = new DoubleField(10); gLength = new DoubleField(10); result = new TextField(72); result.setText("The volume of the cylinder is: " + cylVol); Compute = new Button("Compute"); add(instruct) ; add(mRadius) ; add(gRadius) ; add(mLength) ; add(gLength) ; add(Compute) ; add(result) ; } public boolean action(Event e,Object obj) { if (e.target == Compute) { length = gLength.getDouble(); radius = gRadius.getDouble(); cylVol = pi * radius * radius * length; result.setText("The volume of the cylinder is: " + cylVol); return true; } return false; } }