Advertisement
kernel_memory_dump

Studentska sluzba

Mar 28th, 2014
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.93 KB | None | 0 0
  1. import rajak.Student;
  2. import.java.util.ArrayList;
  3. // Source - > generate toString
  4.  
  5. /*
  6.  
  7. public String toString(){  
  8.     String ispis;
  9.     ispis ="Ime studenta:" + ime;
  10.     ispis += "Prezime studenta" + prezime;
  11.     ispis += "Index:" + index;
  12.     return ispis;
  13.    
  14. }
  15. */
  16.  
  17. public class StudentskaSluzba  {
  18. private ArayList<Student> studenti;
  19.  
  20.  
  21. public StudenskaSluzba(){
  22. studenti = new ArrayList<Student> ( ) ;
  23. }
  24.  
  25. public int getBrojStudenata(){
  26.     return studenti.size();
  27. }
  28.  
  29. public void dodajStudenta( Student s){
  30.     studenti.add(s);
  31. }
  32.  
  33. public void print(){
  34. System.out.println("Imamo trenutno " + studenti.size() + " studenata");
  35.     for ( Student s : studenti ){
  36.         System.out.println("i-ti student:"  + s  );
  37.     }
  38. }
  39.  
  40. public void nadjiStudenata(int brIndex){
  41.     for ( Student s : studenti ){
  42.         if ( s.getBrojIndex() == brIndex) {
  43.             System.out.println("Nadjen student!");
  44.             System.out.println("Informacije o studentu:" + s );
  45.         }
  46. }
  47.  
  48. }
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement