import java.io.*;
import javax.swing.*;
 
class H13Ex5
{
     public static void main (String args[]) throws IOException
     {
	    double xi[]=new double[500];
	    double yi[]=new double[500];
        File f=new File("in.txt");
        JFileChooser dosyasec=new JFileChooser();
        int onay = dosyasec.showOpenDialog(null);
        //veya kayıt için int onay = dosyasec.showSaveDialog(null);
        if(onay==JFileChooser.APPROVE_OPTION) {f=dosyasec.getSelectedFile();}
        int i=-1;
        try{
	    BufferedReader fin=new BufferedReader(new FileReader(f));
        try {
        while(fin != null)
        {
        i++;
        xi[i]=Text.readDouble(fin);
        yi[i]=Text.readDouble(fin);
        }
        } catch(EOFException e_eof) {System.err.println("dosyada veri bitti"); }
        }catch(IOException e_io) {System.err.println("dosya bulunamadı"); } 
        int n=i;
        double x[]=new double[n];
        double y[]=new double[n];         
        for(int j=0;j<n;j++)
        {
	    x[j]=xi[j];
	    y[j]=yi[j];
	    System.out.println(x[j]+"    "+y[j]);
	    }    
     Plot pp=new Plot(x,y);
     pp.plot();
     }
}
