Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bikeshop;
- import java.util.ArrayList;
- public class orej {
- private ArrayList<Employee> emp;
- public orej() {
- this.emp = new ArrayList();
- }
- public boolean pridajEmp(Employee e) {
- return this.emp.add(e);
- }
- public void displayZoznam() {
- if (this.emp.isEmpty()) {
- System.out.print("a lista ures");
- } else {
- for (Employee e : this.emp) {
- e.display();
- }
- }
- }
- public Employee ziskajEmp(int index){
- return this.emp.get(index);
- }
- public int vratIndex(Employee e){
- for(int i=0;i<this.emp.size();i++){
- Employee etemp = this.ziskajEmp(i);
- if(e.equals(etemp)){
- return i;
- }
- }
- return -1;
- }
- ////////////////////////////////////////////////kereses
- public boolean hladajEmp(Employee e){
- return this.emp.contains(e);
- }
- }
- ///////////////////////////////main////////////////////
- Employee e1 = new Employee("Johny", "881105/4323", 1);
- orej zamestnanec = new orej();
- zamestnanec.pridajEmp(e1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement