SHARE
TWEET

Untitled

a guest Oct 18th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   class Human
  2.     {
  3.         public int fullAge;
  4.         public string firstName;
  5.         public string secondName;
  6.         public string gender;
  7.  
  8.         public void getHumanInfo()
  9.         {
  10.             Console.WriteLine($"This human name is {firstName} {secondName}.");
  11.             if (gender == "woman")
  12.             {
  13.                 Console.WriteLine($"She is a {fullAge} years old");
  14.             }
  15.             else if (gender == "man")
  16.             {
  17.                 Console.WriteLine($"He is a {fullAge} years old");
  18.             }
  19.             else
  20.                 Console.WriteLine($"Gender is indefined. It is a {fullAge} years old");
  21.         }
  22.     }
  23.  
  24.     class Teacher : Human
  25.     {
  26.         public int experience;
  27.         public int hoursInWeek;
  28.         public string subject;
  29.         private float salary;
  30.  
  31.     }
  32.  
  33.     class Pupil : Human
  34.     {
  35.         public int form;
  36.         public char formLetter;
  37.     }
  38.  
  39.     class Parent : Human
  40.     {
  41.         private int howMuchCldr;
  42.         private float salary;
  43.     }
  44.  
  45.     class Worker : Teacher
  46.     {
  47.         public string position;
  48.     }
  49.  
  50.     class Program
  51.     {
  52.         static void Main(string[] args)
  53.         {
  54.             Human Alisa = new Human();
  55.             Alisa.firstName = "Alisa";
  56.             Alisa.secondName = "Beznis";
  57.             Alisa.gender = "woman";
  58.             Alisa.fullAge = 15;
  59.  
  60.             Alisa.getHumanInfo();
  61.         }
  62.     }
  63. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top