//bu sinif sinif degiskeni kompleksi boyutlu olarak çcagirir.
//not buradaki bayagikesir sinifi bayagikesir1.java programi
//tarafindan yaratilmistir.

import java.io.*; //java girdi cikti sinifini cagir 
import bayagikesir;


class H6O1  
{ 

public  static void main(String args[]) throws IOException 
{ 
Text cin=new Text();
double n1,n2;
System.out.print("toplam bayagi kesir sayisi, n = ");
int n=cin.readInt(); 
bayagikesir sayi[]=new bayagikesir[n]; 
bayagikesir toplam=new bayagikesir(); 
int i;  

for(i=0;i<sayi.length;i++)
{ 
try{
    System.out.print("bir bayagikesir giriniz : "); 
    n1=cin.readDouble(); 
    n2=cin.readDouble(); 
    sayi[i]=new bayagikesir(n1,n2); 
   }
  catch (gercekSayiException e)
   {
    System.err.println(e.getMessage()); 
    i--; 
   }
}

for(i=0;i<sayi.length;i++)
{ 
    try{
       toplam.topla(sayi[i]);
       }
       catch (bayagikesirException e)
       {
       System.err.println(e.getMessage());
       }
}

System.out.println("Toplam  = "+toplam.toString());

    try{
       toplam.bol(sayi.length);        
       }
       catch (bayagikesirException e)
       {
       System.err.println(e.getMessage());
       }

System.out.println("Ortalama = "+toplam.toString());
} 
}
