Advertisement
Guest User

Untitled

a guest
Apr 21st, 2013
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.22 KB | None | 0 0
  1. package bikeshop;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. public class orej {
  6.    private ArrayList<Employee> emp;
  7.  
  8.  public orej() {
  9.        
  10.         this.emp = new ArrayList();
  11.   }
  12.  
  13.  public boolean pridajEmp(Employee e) {
  14.         return this.emp.add(e);
  15. }
  16.    
  17.  
  18.    public void displayZoznam() {
  19.         if (this.emp.isEmpty()) {
  20.             System.out.print("a lista ures");
  21.         } else {
  22.             for (Employee e : this.emp) {
  23.                 e.display();
  24.             }
  25.         }
  26.     }
  27.    
  28.  public Employee ziskajEmp(int index){
  29.         return this.emp.get(index);
  30.     }
  31.    
  32.    
  33.       public int vratIndex(Employee e){
  34.             for(int i=0;i<this.emp.size();i++){
  35.             Employee etemp = this.ziskajEmp(i);
  36.             if(e.equals(etemp)){
  37.             return i;
  38.             }
  39.             }
  40.             return -1;
  41. }
  42.    
  43. ////////////////////////////////////////////////kereses
  44.      public boolean hladajEmp(Employee e){
  45.  
  46.              return this.emp.contains(e);
  47.     }
  48.    
  49.    
  50. }  
  51.    
  52. ///////////////////////////////main////////////////////
  53.  
  54.  Employee e1 = new Employee("Johny", "881105/4323", 1);
  55.  orej zamestnanec = new orej();  
  56.  zamestnanec.pridajEmp(e1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement