import java.awt.*;
import java.applet.*;


public class Applet1 extends Applet
{
	TextField res=new TextField(30);
	String arreglo[]={"1","2","3","+","-","BORRAR"};
	Button boton[]=new Button(6);
	Panel Centro=new Panel();
	Panel Norte=new Panel();
	Panel Sur=new Panel();
	int temp,acum,i,signo;
	
	public void init()
	{
	setLayout(new BorderLayout());
		Norte.add("Center",res);
		Sur.add("Center",new Button(arreglo[6]));
		Centro.setLayout(new GredLayout(2,3));
		for(i=0;i<=5;i++)
							{
								boton[i]=new Button(arreglo[i]);
							centro.add(boton[i]);
}
add("North",norte);add("Center",centro);
add("South",sur);
}
public boolean action(Event e,Object o)
{
	if (temp<99)
{
if (o.equals("1"))
temp=temp*10+1;
if (o.equals("2"))
temp=temp*10+2;
if (o.equals("3"))
temp=temp*10+3;
res.setText(" "+temp);
}
if (o.equals("+"))
{
acum=acum+temp;
signo=1;
temp=0;
}
if(o.equals("="))
{
if(signo==0)
acum=temp;
if(signo==1)
cont=temp;
res.setText(" "+acum);
}
return true;
}
}