-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContact.java
30 lines (27 loc) · 1006 Bytes
/
Contact.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
public class Contact {
private String group;
private String email;
private String firstName;
private String lastName;
private PhoneNumber phoneNumber;
private Address address;
public Contact(String group, String email, String firstName, String lastName, PhoneNumber phoneNumber, Address address) {
this.group = group;
this.email = email;
this.firstName = firstName;
this.lastName = lastName;
this.phoneNumber = phoneNumber;
this.address = address;
}
public String getFullName() {
return firstName + " " + lastName;
}
@Override
public String toString() {
return "Name: " + getFullName() +
"\nEmail: " + (email != null ? email : "N/A") +
"\nGroup: " + (group != null ? group : "N/A") +
"\nPhone: " + (phoneNumber != null ? phoneNumber.toString() : "N/A") +
"\nAddress: " + (address != null ? address.toString() : "N/A");
}
}