Advertisement
leniuch

indeksy

Feb 25th, 2020
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. public class indeksy {
  2.  
  3.     private float[][]moduly;
  4.     float srednia;
  5.     float suma=0;
  6.     int licznik=0;
  7.    
  8. indeksy(int liczba_studentow,int liczba_modulow){
  9.  
  10. this.moduly=new float [liczba_studentow][liczba_modulow];
  11.  
  12.     for(int x=0;x<moduly.length;x++){
  13.         for(int y=0;y<moduly[x].length;y++){
  14.     moduly[x][y]=0;
  15.        
  16.         }
  17.     }
  18. }
  19.  
  20. public float obliczSrednia(int student){
  21.  
  22.       for(int x=0;x<(moduly.length);x++){
  23.           if(moduly[student][x]!=2) {suma+=moduly[student][x]; licznik++; srednia=suma/licznik;}
  24.           else if(moduly[student][x]!=2) {srednia=2; break;}
  25.           else break;
  26.           }
  27. return srednia;}
  28.  
  29.  public Boolean zaliczony(int student){
  30.  boolean zal = false;
  31.         if(srednia>=3.0) zal = true;
  32. return zal;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement