import java.io.*;
import java.util.*;
import javax.swing.*;

class f3 extends f_x
{ double Km;
double n;
public f3(double Kmi,double ni)
{Km=Kmi;n=ni;}
public double func(double x) 
{
//çözümü istenen fonksiyon	
double ff;
ff=Km*pow(x,n);
return ff; //maksimum testi
}
}

class Km_n1
{    public static double[] boyutludoublegir(String s)
     {
     String s1=JOptionPane.showInputDialog(s);        
     StringTokenizer token=new StringTokenizer(s1);
     int n=token.countTokens()-1;
     int m=n+1;
     double a[]=new double[m];
     int j=0;           
     while(token.hasMoreTokens())
     {
     Double ax=new Double(token.nextToken());
     a[j++]=ax.doubleValue();
     }
     return a;
     }

  public static void main (String args[]) throws IOException
  {  
	  double x[]=boyutludoublegir("Q=Km*dT^n Km ve n değerlerini arasında bir boşluk bırakarak giriniz");
	  f3 f=new f3(x[0],x[1]);
	  Plot pp=new Plot(f,20.0,80.0,400);
	  double xx[]={30.0,50.0,60.0};
	  double yy[]=new double[xx.length];
	  for(int i=0;i<yy.length;i++)
	  {yy[i]=f.func(xx[i]);}
	  pp.addData(xx,yy);
pp.setPlabel("Radyatör ısı transferi Km="+x[0]+" n= "+x[1]+" Q = Km*"+'\u0394'+"T^n");
pp.setXlabel("ortalama yüzey sıcaklığı-ortam sıcaklığı farkı "+'\u0394'+"T derece C"); 
pp.setYlabel("Isı çıktısı W"); 
pp.setPlotType(1,24);
String ss[]={'\u0394'+"T = 30 "+'\u00B0'+"C Q = "+(int)yy[0]+" W",
             '\u0394'+"T = 50 "+'\u00B0'+"C Q = "+(int)yy[1]+" W",
             '\u0394'+"T = 60 "+'\u00B0'+"C Q = "+(int)yy[2]+" W"};            
double xp1=pp.xmin+0.4*(pp.xmax-pp.xmin);
double yp1=pp.ymin+0.2*(pp.ymax-pp.ymin);
pp.addString(ss[0],xx[0],yy[0]-0.05*(pp.ymax-pp.ymin),0);
pp.addString(ss[1],xx[1],yy[1]-0.05*(pp.ymax-pp.ymin),1);
pp.addString(ss[2],xx[2],yy[2]-0.05*(pp.ymax-pp.ymin),2);
pp.plot();
}
}
			