import java.awt.*;
import java.applet.*;
import java.awt.event.*;
//<applet code=Average.class width=400 height=300></applet>
public class Average extends Applet implements ActionListener
{
public TextField input1,input2,display;
public Label labelTitle,label1input,label2input,label3display;
public Button b1;
public int num1,num2;
public double avg;
public void init()
{
input1=new TextField(12);
input2=new TextField(12);
display=new TextField(12);
input1.setText("0");
input2.setText("0");
display.setText("");
display.setEditable(false);
labelTitle=new Label("Average Calculator");
label1input=new Label("First Number");
label2input=new Label("Second Number");
label3display=new Label("Computed Average");
b1=new Button("Push to Compute Average");
b1.addActionListener(this);
add(labelTitle);add(label1input);add(input1);
add(label2input);add(input2);
add(b1);add(label3display);add(display);
}
public void actionPerformed(ActionEvent e);
{
num1=Integer.parseInt(input1.getText());
num2=Integer.parseInt(input2.getText());
avg=((double)num1+num2)/2;
display.setText(""+avg);
}
}