import java.applet.Applet; 
import java.awt.*; 
import java.awt.event.*;

class H3OD4a
{

public static double kuvvet(double a,double b) 
{ 
double k=1.0;
if(b<0)
{
  for(int i=0;i<(int)(-b);i++)
  {k*=a;}
  k=1.0/k;
}
else if(b==0)
{
   k=1.0;
}
else if(b>0)
{
  for(int i=1;i<=(int)b;i++)
  {k*=a;}
}
  return k;
} 

}

public class H3OD4 extends Applet implements ActionListener
{
 double a;
 double b;	
 Label s1;
 TextField t1;
 Label s2;
 TextField t2;

	public void init()
	{
	s1=new Label("tabani giriniz  : ");
	t1=new TextField(10);
   
	s2=new Label("kuvveti giriniz : ");
	t2=new TextField(10);
	add(s1);
	add(t1);
	add(s2);
	add(t2);
        t1.addActionListener(this);
        t2.addActionListener(this);
	}

	public void actionPerformed(ActionEvent e)
	{
	Double sayi1=new Double(t1.getText() );
        a=sayi1.doubleValue();
        Double sayi2=new Double(t2.getText() );
        b=sayi2.doubleValue();
        t1.setText("");
        t2.setText("");
	repaint();
	}

	// trigonometrik fonksiyonların derece cinsinden yazılmış hali
	 public void paint(Graphics g) 
	 { 
	 g.drawString("taban "+a+" nin "+b+" inci kuvveti : "+ H3OD4a.kuvvet(a,b),35,70);
  	 }
 }
