diff --git a/works/lab-06/src/ex1.cs b/works/lab-06/src/ex1.cs new file mode 100644 index 0000000..c80bd3a --- /dev/null +++ b/works/lab-06/src/ex1.cs @@ -0,0 +1,52 @@ +namespace DefaultNamespace; + +public class ex1 +{ + static void Main(string[] args) + { + Pokemon pikachu = new Pokemon("Пикачу", 5, 100); + Pokemon sqr = new Pokemon("Сквиртл", 7, 90); + + pikachu.ShowInfo(); + sqr.ShowInfo(); + } +} + +class Pokemon +{ + private string name; + private int level; + private int hp; + + public string Name + { + get { return name; } + set { name = value; } + } + + public int Level + { + get { return level; } + set { level = value; } + } + + public int Hp + { + get { return hp; } + set { hp = value; } + } + + public Pokemon(string name, int level, int hp) + { + this.name = name; + this.level = level; + this.hp = hp; + } + + public void ShowInfo() + { + Console.WriteLine($"Имя: {this.Name}, Уровень: {this.Level}, HP: {this.Hp}"); + } + + +} \ No newline at end of file