Facebook
From Sole Tamarin, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 167
  1. public class Indeksy2 {
  2.    
  3. private float[][]moduly;
  4.  
  5. Indeksy2(int liczba_studentow,int liczba_modulow){
  6.  
  7. this.moduly=new float [liczba_studentow][liczba_modulow];
  8.  
  9.     for(int x=0;x<moduly.length;x++){
  10.         for(int y=0;y<moduly[x].length;y++){
  11.     moduly[x][y]=0;
  12.        
  13.         }
  14.     }
  15. }
  16. public float obliczSrednia(int student){
  17. float srednia;
  18. float suma=0;
  19. int licznik=0;
  20.       for(int x=0;x<(moduly.length);x++){
  21.           if(moduly[student][x]!=2) {suma+=moduly[student][x]; licznik++;}
  22.           else break;
  23.           }
  24.       srednia=suma/licznik;
  25. return srednia;}
  26.  
  27. public boolean zaliczony_rok(int student){
  28.  
  29. if(obliczSrednia(student)>= 2.0){
  30.        
  31.     return true;    
  32.     }
  33. return false;
  34. }
  35.  
  36. public void wpiszModul(int student,int modul,float ocena){
  37.  
  38. moduly[student][modul]=ocena;
  39.    
  40. }
  41.  
  42.  
  43.  
  44. }
  45.