Advertisement
desislava_topuzakova

Athlete.cs

May 10th, 2020
1,223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace Exam_Preparation_2_Fitness
  6. {
  7.     public class Athlete
  8.     {
  9.         //име, възраст, сила
  10.         private string name;
  11.         private int age;
  12.         private int strength;
  13.  
  14.         public Athlete(string name, int age, int strength)
  15.         {
  16.             Name = name;
  17.             Age = age;
  18.             Strenght = strength;
  19.         }
  20.  
  21.         public string Name
  22.         {
  23.             get
  24.             {
  25.                 return name;
  26.             }
  27.             set
  28.             {
  29.                 name = value;
  30.             }
  31.         }
  32.  
  33.         public int Age
  34.         {
  35.             get
  36.             {
  37.                 return age;
  38.             }
  39.             set
  40.             {
  41.                 age = value;
  42.             }
  43.         }
  44.  
  45.         public int Strenght
  46.         {
  47.             get
  48.             {
  49.                 return strength;
  50.             }
  51.             set
  52.             {
  53.                 strength = value;
  54.             }
  55.         }
  56.  
  57.         public override string ToString()
  58.         {
  59.             //Athlete: name - <име>, age - <възраст> strength <сила>.
  60.             return $"Athlete: name - {name}, age - {age} strenght {strength}.";
  61.         }
  62.  
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement