import java.io.*;
import Text;
import java.util.*;

//Stack - dizi ornegi

public class H10AL5
{
  public static void main(String[] args) throws IOException
  {
    DataInputStream input; 
    Stack l= new Stack();
    String s1;
    Text cin= new Text();
    System.out.print("Lutfen dosya ismini giriniz: ");
    s1 = cin.readString();
    File myfile = new File(s1);
    BufferedReader b= new BufferedReader(new FileReader(myfile));     
    int toplam=0; 
    boolean EOF=false;
    int j=0;
    while (!EOF)
    {
     try
     { 
      l.push(Text.readString(b));
      j++;
     }
     catch (EOFException e)
     { 
       b.close(); 
       EOF=true;
     }
    } //while
            while(!l.empty())
                 {
                 Double d=new Double((String)l.pop());  
                 toplam+=d.doubleValue();
                 System.out.println(""+d+" toplam: "+toplam);
                 }
    System.out.println("dosyanin ve yuklendigi listenin icindeki sayilarin adedi: "+j);
    System.out.println("Ortalama: "+(double)toplam/j);    
  } //main

} //class
