radko93

Untitled

Jan 20th, 2013
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1.  
  2. public class Szkola {
  3.     int n;
  4.     Uczen lista[]=new Uczen[n];
  5.    
  6.     public void dodaj(Uczen im) {
  7.         for(int i=0; i<lista.length;i++) {
  8.             while(lista[i]!=null)
  9.                 lista[i]=im;
  10.         }
  11.     }
  12.         public void wyswietl(double przedmiot, double srednia) {
  13.             for(int i=0;i<lista.length; i++) {
  14.             if(lista[i].przedmiot>=srednia) {
  15.             System.out.printf("%20s","Lista uczniow");
  16.             System.out.print(i +" | \t");
  17.             System.out.printf("%7s%7s%7d", lista[i].nazwisko,lista[i].imie,lista[i].przedmiot);
  18.             }
  19.            
  20.             }
  21.            
  22.         }
  23.    
  24.     public static void main(String[] args) {
  25.         Szkola test = new Szkola();
  26.         test.dodaj(new Uczen("Marek","Adamczyk",1993,3.50,4.20,5.17));
  27.         test.dodaj(new Uczen("Marek","Polakowski",1994,4.20,3.17,2.56));
  28.         test.dodaj(new Uczen("Robert","Polakowski",1994,2.20,3.15,2.20));
  29.         test.dodaj(new Uczen("Marcin","Galant",1994,3.50,5.80,5.15));
  30. test.wyswietl(chem, 4.0);
  31.     }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment