loading
main.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
using System;

class MainClass {
  public static void Main (string[] args) {

    Person per1 = new Person();
    per1.setFirstName("Kenan");
    per1.setLastName("Hancer");

    Console.WriteLine(per1.ToString());
  }
}

class Person
{
  private string firstName;
  private string lastName;
  private const string ARGUMENT_MESSAGE = "Null or Zero-length string invalid";

  public string getFirstName()
  {
    return this.firstName;
  }

  public void setFirstName(string firstName)
  {
    if(String.IsNullOrEmpty(firstName))
      throw new ArgumentException(ARGUMENT_MESSAGE, "firstName");

    this.firstName = firstName;
  }

  public string getLastName()
  {
    return this.lastName;
  }

  public void setLastName(string lastName)
  {
    if(String.IsNullOrEmpty(lastName))
      throw new ArgumentException(ARGUMENT_MESSAGE, "lastName");

    this.lastName = lastName;
  }

  private string getPersonFullName()
  {    
    return this.getFirstName() + " " + this.getLastName();
  }

  public override string ToString()
  {
    return getPersonFullName();
  }
}