Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import rajak.Student;
- import.java.util.ArrayList;
- // Source - > generate toString
- /*
- public String toString(){
- String ispis;
- ispis ="Ime studenta:" + ime;
- ispis += "Prezime studenta" + prezime;
- ispis += "Index:" + index;
- return ispis;
- }
- */
- public class StudentskaSluzba {
- private ArayList<Student> studenti;
- public StudenskaSluzba(){
- studenti = new ArrayList<Student> ( ) ;
- }
- public int getBrojStudenata(){
- return studenti.size();
- }
- public void dodajStudenta( Student s){
- studenti.add(s);
- }
- public void print(){
- System.out.println("Imamo trenutno " + studenti.size() + " studenata");
- for ( Student s : studenti ){
- System.out.println("i-ti student:" + s );
- }
- }
- public void nadjiStudenata(int brIndex){
- for ( Student s : studenti ){
- if ( s.getBrojIndex() == brIndex) {
- System.out.println("Nadjen student!");
- System.out.println("Informacije o studentu:" + s );
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement