From c10dd82d2af9c7938621a22bd78151cd45ee71d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B8=D0=BC=D0=BE=D0=BD=D0=BE=D0=B2=20=D0=90=D1=80?= =?UTF-8?q?=D1=82=D0=B5=D0=BC?= Date: Tue, 24 Nov 2026 11:41:31 +0000 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20works/csharp/Readme(lab=207).md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- works/csharp/Readme(lab 7).md | 96 +++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 works/csharp/Readme(lab 7).md diff --git a/works/csharp/Readme(lab 7).md b/works/csharp/Readme(lab 7).md new file mode 100644 index 0000000..e7d688b --- /dev/null +++ b/works/csharp/Readme(lab 7).md @@ -0,0 +1,96 @@ +using System.Net.Security; + +// task 1 +class Pokemon +{ + protected string name; + protected int level; + protected int hp; + + public Pokemon(string name, int level, int hp) + { + Name = name; + Level = level; + Hp = 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 virtual void Attack() + { + Console.WriteLine("Покемон атакует"); + } + + public void ShowInfo() + { + Console.Write($"{Name},(Ур. {Level}): "); + } +} +class Pikachu : Pokemon +{ + public Pikachu(int level, int hp) : base("Пикачу", level, hp) + { + } + public override void Attack() + { + Console.WriteLine("Пика-пика! Удар током!"); + } +} +class Squirtle : Pokemon +{ + public Squirtle(int level, int hp) : base("Сквиртл", level, hp) + { + } + public override void Attack() + { + Console.WriteLine("Сквирт-сквирт! Водяной пистолет!"); + } +} +class Charmander : Pokemon +{ + public Charmander(int level, int hp) : base("Чармандер", level, hp) + { + } + public override void Attack() + { + Console.WriteLine("Чар-чар! Огненный хвост!"); + } +} + +class Program +{ + static void Main(string[] args) + { + Pikachu pikachu = new Pikachu(5, 40); + Squirtle squirtle = new Squirtle(7, 44); + Charmander charmander = new Charmander(6, 39); + + Console.WriteLine("=== ПОКЕДЕКС: АТАКИ ==="); + + pikachu.ShowInfo(); + pikachu.Attack(); + + squirtle.ShowInfo(); + squirtle.Attack(); + + charmander.ShowInfo(); + charmander.Attack(); + + Console.ReadLine(); + } +} \ No newline at end of file