Task02

Run Settings
LanguageC#
Language Version
Run Command
using System; using Task02; namespace Task01 { internal class Program { static void Main(string[] args) { Person p1 = new Person(); p1.SetName("Vanja"); p1.SetAge(18); p1.SetLenght(183.9); p1.SetWeight(84); p1.SetSocial_Points(-999); Person p2 = new Person(); //p2.SetName("Vovan"); //p2.SetAge(19); //p2.SetLenght(178.3); //p2.SetWeight(90); //p2.SetSocial_Points(911); Person p3 = new Person(); p3.SetName("Ruslan"); p3.SetAge(17); p3.SetLenght(-999); p3.SetWeight(76); p3.SetSocial_Points(666); Console.WriteLine(p1.ToText()); Console.WriteLine(p2.ToText()); Console.WriteLine(p3.ToText()); } } }
namespace Task02 { public class Person { private string name = "undefind"; /*Ім'я екземпляру*/ private ushort age = 0; /*Вік екземпляру*/ private uint weight = 0; /*Вага екземпляру*/ private double lenght = 0; /*Ріст екземпляру*/ private int social_points = 0; /*Соціальний кредит екземпляру*/ public void SetName(string name) { this.name = name; } /*Сеттер імені*/ public string GetName() { return this.name; } /*Геттер імені*/ public void SetAge(ushort age) { this.age = age; } /*Сеттер віку*/ public ushort GetAge() { return this.age; } /*Геттер віку*/ public void SetWeight(uint weight) { this.weight = weight; } /*Сеттер ваги*/ public uint GetWeight() { return this.weight; } /*Геттер ваги*/ public void SetLenght(double lenght) { if(lenght > 0) this.lenght = lenght; } /*Сеттер росту*/ public double GetLenght() { return this.lenght; } /*Геттер росту*/ public void SetSocial_Points(int social_points) { this.social_points = social_points; } /*Сеттер соціального кредиту*/ public int GetSocial_Points() { return this.social_points; } /*Геттер соціального кредиту*/ /** * @context Повертає дані як строку * * @param void * @return (string)дані */ public string ToText() { return string.Format("Name: {0}\nAge: {1}\nWeight: {2}\nLenght: {3}\n Social Points: {4}\n", this.name, this.age, this.weight, this.lenght, this.social_points); } } }
Editor Settings
Theme
Key bindings
Full width
Lines