JAVA CODE

//Ex121 program
import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;

public class Ex121 extends Applet
             implements ActionListener
{
  Label radius;
  TextField numText;
  int num;

  public void init()
  {
    radius = new Label(" Please input a radius " );
    add(radius);

    numText = new TextField(3);
    add(numText);
    numText.addActionListener(this);
  }

  public void paint ( Graphics g )
  {
    double con = 3.14159;
    int diameter = num * 2; 
    double circumference = num * 2 * con;
    double area = num * num * con;

    g.drawString(" The circle's diameter is : " + diameter, 30, 100 );
    g.drawString(" The circle's circumference is : " + circumference, 30, 120 );
    g.drawString(" The circle's area is : " + area, 30, 140 );
  }

  public void actionPerformed ( ActionEvent e )
  {
    num = Integer.parseInt(numText.getText());
    repaint();
  }
}