-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPerson.java
89 lines (68 loc) · 1.92 KB
/
Person.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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package task7;
public class Person {
// Attributes
private String personType;
private String firstName;
private String secondName;
private String address;
private String cellNumber;
private String email;
// Getters and setters method
public String getPersonType() {
return personType;
}
public void setPersonType(String personType) {
this.personType = personType;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getSecondName() {
return secondName;
}
public void setSecondName(String secondName) {
this.secondName = secondName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCellNumber() {
return cellNumber;
}
public void setCellNumber(String cellNumber) {
this.cellNumber = cellNumber;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
// Constructor of getters and setters methods
public Person(String personType, String firstName, String secondName, String address, String cellNumber, String email)
{
setPersonType(personType);
setFirstName(firstName);
setSecondName(secondName);
setAddress(address);
setCellNumber(cellNumber);
setEmail(email);
}
// Converts all variables to strings and outputs in a formal manner
public String toString ()
{
String output = "Person type: " + getPersonType() + "\n";
output += "First name of person: " + getFirstName() + "\n";
output += "Surname of person: " + getSecondName() + "\n";
output += "Physical address of person: " + getAddress() + "\n";
output += "Cell number of person: " + getCellNumber() + "\n";
output += "Email address of person: " + getEmail();
return output;
}
}