kisame1313

Untitled

Jul 22nd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main ( string [] args )
  6.     {
  7.         House mylonelyhouse = new House ( ConsoleColor.Red, "Dnishche", 10 );
  8.         mylonelyhouse.ShowAdress ();
  9.     }
  10. }
  11.  
  12. class House
  13. {
  14.     ConsoleColor HouseColor;
  15.     string Adress;
  16.     int MaxTenants;
  17.     private Tenant [] Tenants;
  18.  
  19.     public House ( ConsoleColor col, string adr, int max )
  20.     {
  21.         HouseColor = col;
  22.         Adress = adr;
  23.         MaxTenants = max;
  24.         Tenants = new Tenant [max];
  25.     }
  26.  
  27.     public void ShowAdress ( )
  28.     {
  29.         ConsoleColor defaultColor = Console.ForegroundColor;
  30.         Console.ForegroundColor = HouseColor;
  31.         Console.WriteLine (Adress);
  32.         Console.ForegroundColor = defaultColor;
  33.     }
  34. }
  35.  
  36. class Tenant
  37. {
  38.     string Name;
  39.     byte Age;
  40.  
  41.     public Tenant (string name, byte age)
  42.     {
  43.         Name = name;
  44.         Age = age;
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment