Kroppeek

4

Jan 31st, 2020
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.95 KB | None | 0 0
  1. class Skoki{
  2.     private float [][] konkursy;
  3.     Skoki(int liczba_skoczkow, int liczba_konkursow){
  4.         konkursy = new float[liczba_skoczkow][liczba_konkursow];
  5.  
  6.     }
  7.     float sredniaWynikow(int skoczek){
  8.         float srednia=0;
  9.         int x = 0;
  10.        
  11.         for(int i : konkursy[skoczek]){
  12.             srednia += i;
  13.             x++;
  14.            
  15.         }
  16.         return srednia/x;
  17.  
  18.     }
  19.     boolean dobrySezon(int skoczek, float punkty){
  20.  
  21.         return sredniaWynikow(skoczek)>punkty;
  22.  
  23.  
  24.     }
  25.     void wpiszWynik(int skoczek, int konkurs, float punkty){
  26.         konkurs[skoczek][konkurs] = punkty;
  27.  
  28.     }  
  29.     void piszDane(int skoczek){
  30.         System.out.print(skoczek + " ");
  31.         for (int xd : konkursy[skoczek]){
  32.             System.out.print(xd + "  ");
  33.         }
  34.         System.out.print(sredniaWynikow(skoczek));
  35.     }
  36.  
  37. }
  38. --------------------------------------------------------------------------------------------------------
  39. class skoki{
  40.         private float [][] konkursy;
  41.         skoki(int liczba_skoczkow, int liczba_konkursow)
  42.         {
  43.             konkursy = new float [liczba_skoczkow][liczba_konkursow];
  44.         }
  45.         float sredniaWynikow(int skoczek){
  46.             float srednia=0;
  47.             int x;
  48.             for(int f : konkursy[skoczek])
  49.             {
  50.                 srednia +=f;
  51.                 x++;
  52.             }
  53.             return srednia/x;
  54.         }
  55.         boolean dobrySezon(int skoczek, float punkty){
  56.             return sredniaWynikow(skoczek)>punkty;
  57.         }
  58.         void wpiszWynik(int skoczek, int konkurs, float punkty){
  59.             konkursy[skoczek][konkurs]= punkty;
  60.         }
  61.         void piszDane(int skoczek){
  62.             System.out.print(skoczek+" ");
  63.             for(int e : konkursy[skoczek]){
  64.                 System.out.print(e+" ");
  65.             }
  66.             System.out.print(sredniaWynikow(skoczek));
  67.         }
  68. }
  69. ----------------------------------------------------------------------------------------------------------------\
  70. Double funkcja(String filename, String nazwisko){
  71.         Scanner odczyt = new Scanner(new File(filename + "txt"));
  72.         PrintWriter zapis = new PrintWriter(new File(filename +"WYN"));
  73.                 double srednia =0;
  74.  
  75.         try{
  76.             while(odczyt.hasNextLine()){          
  77.                  String nazwiskoo = odczyt.nextLine();
  78.                  int rok_studiow = odczyt.nextInt();
  79.                  double srednia_ocen = odczyt.nextDouble();
  80.                 char plec = odczyt.nextLine().charAt(0);
  81.  
  82.                 if (nazwisko.equals(nazwiskoo)){
  83.                     srednia = srednia_ocen;
  84.                 }
  85.                 if(plec=='K'&&rok_studiow>=2){
  86.                     zapis.print(nazwiskoo+"."+srednia_ocen);
  87.  
  88.                 }
  89.            
  90.             }
  91.  
  92.  
  93.  
  94.         }catch(IOException e){
  95.             e.printStackTrace();
  96.  
  97.  
  98.         }
  99.  
  100.  
  101. }
  102. ----------------------------------------------------------------------------------------------
  103. class skoki{
  104.     private float [][] konkursy;
  105.     skoki(int liczba_skoczkow, int liczba_konkursow){
  106.         konkursy = new float[liczba_skoczkow][liczba_konkursow];
  107.  
  108.     }
  109.     float sredniaWynikow(int skoczek){
  110.             float srednia=0;
  111.             int x=0;
  112.  
  113.  
  114.         for (int f: konkursy[skoczek]){
  115.                 f += srednia;
  116.                 x++;
  117.  
  118.         }
  119.         return srednia/x;
  120.     }
  121.     boolean dobrySezon(int skoczek, float punkty){
  122.  
  123.             return sredniaWynikow[skoczek]> punkty;
  124.     }
  125.     void wpiszWynik(int skoczek, int konkurs, float punkty){
  126.         konkursy[skoczek][konkurs] = punkty;
  127.     }
  128.     void piszDane(int skoczek){
  129.         System.out.print(skoczek +" ";
  130.         for (int e : konkursy[skoczek]){
  131.             System.out.print(e +" ");
  132.             System.out.print(sredniaWynikow(skoczek) + " ");
  133.  
  134.         }
  135.     }
  136. }
  137. ---------------------------------------------------------------------------------------------
Add Comment
Please, Sign In to add comment