import java.applet.Applet;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class E6extends Applet implements ActionListener
{
TextField text1,text2,text3;
Button button1,button2,button3,button4;
public void init()
{
text1=new TextField(10);
text2=new TextField(10);
text3=new TextField(10);
button1=new Button("+");
button2=new Button("-");
button3=new Button("*");
button4=new Button("/");
add(text1);
add(text2);
add(text3);
add(button1);
add(button2);
add(button3);
add(button4);
button1.addActionListener(this);
button2.addActionListener(this);
button3.addActionListener(this);
button4.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
long n,n1,n2;
n1=Long.parseLong(text1.getText());
n2=Long.parseLong(text2.getText());
if(e.getSource()==button1)
{
n=n1+n2;
text3.setText(String.valueOf(n));
}
else if (e.getSource()==button2)
{n=n1-n2;
text3.setText (String.valueOf(n));
}
else if (e.getSource()==button3)
{n=n1*n2;
text3.setText (String.valueOf(n));
}
else
{n=n1/n2;
text3.setText(String.valueOf (n));
}
}
}