Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace CSLight
- {
- public class Program
- {
- static void Main(string[] args)
- {
- Player player = new Player("Родион", 25, 80);
- player.OutputInformation();
- }
- }
- class Player
- {
- private string _name;
- private int _age;
- private float _weight;
- public Player(string name, int age, float weight)
- {
- _name = name;
- if (age >= 100 || age <= 0)
- {
- _age = 0;
- }
- else
- {
- _age = age;
- }
- _weight = weight;
- }
- public Player()
- {
- _name = "none";
- _age = 0;
- _weight = 0;
- }
- public void OutputInformation()
- {
- Console.WriteLine($"Имя:{_name}\nВозраст:{_age}\nВес:{_weight}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement