Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Zadanie_klasy
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. Wyswietl_dane A = new Wyswietl_dane();
  10.  
  11. A.WczytajBokA();
  12. A.WczytajBokB();
  13. A.ObliczPole();
  14. Console.WriteLine(A.Wypisz());
  15.  
  16. Console.ReadKey();
  17.  
  18. }
  19. }
  20.  
  21. class Czytaj_dane
  22. {
  23. protected int BokA = 2;
  24. protected int BokB = 2;
  25.  
  26. public int WczytajBokA()
  27. {
  28.  
  29.  
  30. int.TryParse(Console.ReadLine(), out BokA);
  31.  
  32.  
  33. return BokA;
  34.  
  35. }
  36.  
  37. public int WczytajBokB()
  38. {
  39.  
  40. int.TryParse(Console.ReadLine(), out BokB);
  41.  
  42.  
  43. return BokB;
  44. }
  45.  
  46.  
  47.  
  48. }
  49.  
  50. class Przetworz_dane : Czytaj_dane
  51. {
  52. protected int Powierzchnia;
  53.  
  54. public int ObliczPole()
  55. {
  56. Powierzchnia = BokA * BokB;
  57.  
  58. return Powierzchnia;
  59.  
  60. }
  61.  
  62.  
  63. }
  64.  
  65. class Wyswietl_dane : Przetworz_dane
  66. {
  67.  
  68.  
  69. public int Wypisz()
  70. {
  71. return Powierzchnia;
  72. }
  73.  
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement