-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPersonCode.cs
84 lines (66 loc) · 1.69 KB
/
PersonCode.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace intuinless1
{
class Person
{
private string _FirstName;
private string _LastName;
private int _Age;
public string FirstName
{
get { return _FirstName; }
set { _FirstName = value; }
}
public string LastName
{
get { return _LastName; }
set { _LastName = value; }
}
public int Age
{
get { return _Age; }
set {
if (value >= 0 )
{
_Age = value;
}
else
{
throw new ArgumentException();
}
}
}
public Person(string firstName , string lastName , int age )
{
FirstName = firstName;
LastName = lastName;
Age = age;
}
public override string ToString()
{
return ("Name is: " + FirstName + " " + "\nLastName is: " + LastName + " " + "\nAge is:" + " " + Age);
}
public void WriteHello(string someName)
{
Console.WriteLine("Hello" + " " + someName);
}
public void WriteEtcInfo()
{
Console.WriteLine("These info about ur new patient: ");
}
}
public class Program
{
static void Main()
{
Person person1 = new Person("Petr","loxov",18);
person1.WriteHello("Jo");
person1.WriteEtcInfo();
Console.WriteLine(person1);
}
}
}