-
Notifications
You must be signed in to change notification settings - Fork 0
/
Address.cs
90 lines (79 loc) · 1.98 KB
/
Address.cs
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
90
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SchoolClassManager
{
/// <summary>
/// treat address of a student as own class
/// </summary>
public class Address
{
/// <summary>
/// fields
/// </summary>
private string city;
private string street;
private string zip;
/// <summary>
/// default constructor
/// </summary>
public Address()
{
}
/// <summary>
/// Constructor with four parameters
/// </summary>
/// <param name="city">city as input</param>
/// <param name="country">the country as enum as input</param>
/// <param name="street">street as input</param>
/// <param name="zip">zip code as input</param>
/// <remarks></remarks>
public Address(string city, string street, string zip) : this()
{
this.city = city;
this.street = street;
this.zip = zip;
}
/// <summary>
/// properties - allowing write and read access
/// </summary>
public string City
{
get
{
return city;
}
set
{
if (!string.IsNullOrEmpty(value)) // for all properties, perform an input validation - values should not be zero
city = value;
}
}
public string Street
{
get
{
return street;
}
set
{
if (!string.IsNullOrEmpty(value))
street = value;
}
}
public string Zip
{
get
{
return zip;
}
set
{
if (!string.IsNullOrEmpty(value))
zip = value;
}
}
}
}