Facebook
From Mammoth Capybara, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 118
  1. public class Indeksy {
  2.    
  3. private float[][]moduly;
  4.  
  5. Indeksy(int numer_studenta,int numer_modulu){
  6.  
  7.     this.moduly=new float[numer_studenta][numer_modulu];
  8.  
  9.         for(int x=0;x<moduly.length;x++){
  10.             for(int y=0;y<moduly[x].length;y++){
  11.  
  12.         moduly[x][y]=0;        
  13.            
  14.         }   }}
  15.  
  16.     public float obliczSrednia(int student){    
  17.     float srednia=0;
  18.     int suma=0;
  19.     int licznik=0;
  20.    
  21.     for(int x=0;x<moduly.length;x++){
  22.         if(moduly[student][x]>2.0){
  23.         srednia=suma/licznik;}
  24.         else {return 2;}
  25.    
  26.    
  27.     }
  28.         return srednia;
  29.     }
  30.  
  31.     public boolean zaliczonyRok(int student){
  32.    
  33.     if(obliczSrednia(student)>2.0){
  34.         return true;}
  35.             else return false;
  36.     }
  37.    
  38.    
  39.  
  40.    
  41.     public void wpiszModul(int student,int modul,float ocena){
  42.    
  43.     moduly[student][modul]=ocena;
  44.  
  45.     }
  46.  
  47.  
  48.     public void piszDane(int student){    
  49.     System.out.print(student);
  50.     for(int x=0;x<moduly[student].length;x++) {
  51.     System.out.print(moduly[student][x]);
  52.     }
  53.     System.out.print(zaliczonyRok(student));
  54.              
  55.     }}
  56.