-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAddress.java
More file actions
87 lines (75 loc) · 1.62 KB
/
Copy pathAddress.java
File metadata and controls
87 lines (75 loc) · 1.62 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
75
76
77
78
79
80
81
82
83
84
85
86
87
package components;
/**
*
* @author Nadav Ishai, ID: 206119893
*
*class Address represent addresses of both sender and recipient
*/
public class Address {
private int zip;
private int street;
/**
* Address constructor
* @param zip = zip number of an address
* @param street = street number of an address
*
*/
public Address(int zip, int street) {
this.Set_Zip(zip);
this.Set_Street(street);
}
/**
* Address copy constructor
* @param a = other Address object
*/
public Address(Address a) {
this.zip = a.zip;
this.street = a.street;
}
/**
* Function Get_Zip return address's zip number
* @return zip
*/
public int Get_Zip() {
return zip;
}
/**
* Function Get_Street return address's street number
* @return street
*/
public int Get_Street() {
return street;
}
/**
* Function Get_Address return address as String
* @return String(address)
*/
public String Get_Address() {
return zip + "-" + street;
}
/**
* Function Set_Zip is setting an address zip number
* @param z = a zip number to set
*/
public void Set_Zip(int z) {
zip = z;
}
/**
* Function Set_Street is setting an address street number
* @param s = a street number to set
*/
public void Set_Street(int s) {
this.street = s;
}
/**
* Function Set_Address is setting an address like the parameter address
* @param a = address to set
*/
public void Set_Address(Address a) {
this.Set_Zip(a.Get_Zip());
this.Set_Street(a.Get_Street());
}
public String toString() {
return zip+"-"+street;
}
}