Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp13
  8. {
  9.  
  10.  
  11. class Dzialka
  12. {
  13. public string adres;
  14. public double powierzchnia;
  15.  
  16.  
  17.  
  18. public Dzialka(string adres,double powierzchnia)
  19. {
  20. this.adres = adres;
  21. this.powierzchnia = powierzchnia;
  22. }
  23. public void kup(Osoba osoba)
  24. {
  25. osoba.miejsce_zamieszkania=this.adres;
  26.  
  27. }
  28. }
  29.  
  30. class Dom : Dzialka
  31. {
  32. public int wielkosc;
  33. public int ile_pieter;
  34. public Dom(int wielkosc,int ile_pieter,string adres,double powierzchnia)
  35. :base(adres,powierzchnia)
  36. {
  37. this.wielkosc = wielkosc;
  38. this.ile_pieter = ile_pieter;
  39. this.adres = base.adres;
  40. this.powierzchnia = base.powierzchnia;
  41. }
  42. public int wypierdalaj()
  43. {
  44. return 0;
  45. }
  46. }
  47. class Buda:Dzialka
  48. {
  49. public int wielkosc;
  50. public string material;
  51.  
  52. public Buda(int wielkosc,string material, string adres, double powierzchnia) :base(adres,powierzchnia)
  53. {
  54. this.wielkosc = wielkosc;
  55. this.material = material;
  56. this.adres = base.adres;
  57. this.powierzchnia = base.powierzchnia;
  58. }
  59. }
  60.  
  61.  
  62. class Pokoj
  63. {
  64. public Dom dom;
  65. public Osoba osoba;
  66. public int metry_kw;
  67. public Pokoj(int metry_kw,string kto_mieszka,Dom dom,Osoba osoba)
  68. {
  69. this.metry_kw = metry_kw;
  70. this.dom = dom;
  71. this.osoba = osoba;
  72. }
  73.  
  74.  
  75. public void wyswietl()
  76. {
  77. Console.WriteLine("Pokoj ma: " + this.metry_kw);
  78. Console.WriteLine("Kto w nim mieszka: " + osoba.ImieINazwisko);
  79. Console.WriteLine("Gdzie sie znajduje: " + dom.adres);
  80. Console.WriteLine("Ile lat ma wlasciciel: " + osoba.wiek);
  81. }
  82. }
  83. class Osoba
  84. {
  85. public string ImieINazwisko;
  86. public string miejsce_zamieszkania;
  87. public int wiek;
  88. public Osoba()
  89. {
  90. this.ImieINazwisko = "Dominik Makowski";
  91. this.miejsce_zamieszkania = "Nigdzie";
  92. this.wiek = 20;
  93. }
  94.  
  95. }
  96. class Program
  97. {
  98. static void Main(string[] args)
  99. {
  100.  
  101. Dzialka dzialka = new Dzialka("Wspomnien 23 xDD", 125);
  102. Dom dom = new Dom(60, 1, dzialka.adres, dzialka.powierzchnia);
  103. Buda buda = new Buda(20, "Drewno", dzialka.adres, 2);
  104. Osoba osoba = new Osoba();
  105. dzialka.kup(osoba);
  106. Pokoj pokoj = new Pokoj(15, osoba.ImieINazwisko, dom,osoba);
  107. pokoj.wyswietl();
  108. string x;
  109. x = Console.ReadLine();
  110.  
  111.  
  112.  
  113. }
  114. }
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement