-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContact.java
More file actions
74 lines (74 loc) · 2.01 KB
/
Contact.java
File metadata and controls
74 lines (74 loc) · 2.01 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* One object of this class represents
* information on one Contact. This includes
* first name, last name, street address, email,
* phone number and notes. //WW
*/
import java.io.Serializable;
public class Contact implements Serializable{
private String firstName, lastName, street,
email, phone, notes; //WW
/**
* Constructs contact info
*/
public Contact(String firstName, String lastName, String street, String email,
String phone, String notes) { //WW
this.firstName = firstName;
this.lastName = lastName;
this.street = street;
this.email = email;
this.phone = phone;
this.notes = notes;
}
/**
* Assigns constants in the firstName String to newFirstName
*/
public void setFirstName(String newFirstName){ //WW
firstName = newFirstName;
}
/**
* Assigns constants in the lastName String to newLastName
*/
public void setLastName(String newLastName){ //WW
lastName = newLastName;
}
/**
* Returns the contacts last name
*/
public String getLastName(){ //WW
return lastName;
}
/**
* Assigns constants in the street String to newStreetAddress
*/
public void setStreetAddress(String newStreetAddress){ //WW
street = newStreetAddress;
}
/**
* Assigns constants in the email String to newEmail
*/
public void setEmail(String newEmail){ //WW
email = newEmail;
}
/**
* Assigns constants in the phone String to newPhoneNumber
*/
public void setPhoneNumber(String newPhoneNumber){ //WW
phone = newPhoneNumber;
}
/**
* Assigns constants in the notes String to newNotes
*/
public void setNotes(String newNotes){ //WW
notes = newNotes;
}
/**
* Returns a String representation of a contact's info
*/
public String toString(){ //WW and RS
return "\n" + "First name: " + firstName + "\n" + "Last name: "
+ lastName + "\n" + "Street address: " + street + "\n"
+ "E-mail address: " + email + "\n" + "Phone number: "
+ phone + "\n" + "Notes: " + notes + "\n";
}
}