-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContato.java
More file actions
43 lines (36 loc) · 1.18 KB
/
Contato.java
File metadata and controls
43 lines (36 loc) · 1.18 KB
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
38
39
40
41
42
43
public class Contato {
private String nome;
private String sobrenome;
private String email;
private int codigoTelefonicoPais;
private long telefone;
public Contato(String nome, String sobrenome, String email, int codigoTelefonicoPais, long telefone) {
this.nome = nome;
this.sobrenome = sobrenome;
this.email = email;
this.codigoTelefonicoPais = codigoTelefonicoPais;
this.telefone = telefone;
}
public String getNome() {
return nome;
}
public String getSobrenome() {
return sobrenome;
}
public String getEmail() {
return email;
}
public int getCodigoTelefonicoPais() {
return codigoTelefonicoPais;
}
public long getTelefone() {
return telefone;
}
public String getNumeroTelefoneFormatado() {
String telefoneStr = String.valueOf(telefone);
String parte1 = telefoneStr.substring(0, 2);
String parte2 = telefoneStr.substring(2, 7);
String parte3 = telefoneStr.substring(7);
return String.format("+%d (%s) %s-%s", codigoTelefonicoPais, parte1, parte2, parte3);
}
}