Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace Kalucki4_5
  4. {
  5. public class Program
  6. {
  7. public static void Main(string[] args)
  8. {
  9. Kwadrat kw = new Kwadrat(5);
  10. Console.WriteLine(kw.ToString());
  11. }
  12. }
  13.  
  14. public interface IFigura
  15. {
  16. int Obwod { get; }
  17. int Pole { get; }
  18. }
  19.  
  20. public class Kwadrat : IFigura
  21. {
  22. private int dlBoku;
  23.  
  24. public Kwadrat(int dlBoku)
  25. {
  26. this.dlBoku = dlBoku;
  27. }
  28.  
  29. public int Obwod
  30. {
  31. get
  32. {
  33. return 4 * dlBoku;
  34. }
  35. }
  36.  
  37. public int Pole
  38. {
  39. get
  40. {
  41. return dlBoku * dlBoku;
  42. }
  43. }
  44.  
  45. public override string ToString()
  46. {
  47. return "Kwadrat: " + dlBoku.ToString();
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement