-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCollega.java
37 lines (30 loc) · 888 Bytes
/
Collega.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package prg.es2;
public class Collega extends Contatto{
private String qualifica;
public Collega(){}
public Collega(String name, String surname, long phone, String qualifica) {
super(name, surname, phone);
this.setQualifica(qualifica);
}
//METODI SET
public Collega setQualifica(String qualifica){
this.qualifica = qualifica;
return this;
}
//METODI GET
public String getQualifica(){
return this.qualifica;
}
@Override
public boolean equals(Object other){
if(other instanceof Collega){
Collega sec = (Collega) other;
return this.getName().equals(sec.getName()) && this.getSurname().equals(sec.getSurname()) && this.getPhone() == sec.getPhone() && this.getQualifica().equals(sec.getQualifica());
}
return false;
}
@Override
public String toString(){
return super.toString() + this.getQualifica();
}
}