Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8. class Tacka
  9. {
  10. private double _x;
  11. private double _y;
  12.  
  13. public void SetX(double x)
  14. {
  15. this._x = x;
  16. }
  17. public double GetX()
  18. {
  19. return this._x;
  20. }
  21. //property za pristup polju _y
  22. public double Y
  23. {
  24. get { return _y; }
  25. set { this._y = value; }
  26. }
  27. public Tacka () {}
  28. public Tacka(double x,double y)
  29. {
  30. this.SetX(x);//poziv metode za setovanje vrednosti
  31. this.Y = y;//poziv propertija
  32. }
  33. public string Prikazi()
  34. {
  35. string pom = string.Format("{0},{1}", this.GetX(),this.Y);
  36. return pom;
  37. }
  38. public Tacka Centar
  39. {
  40. get { return _centar; }
  41. set
  42. {
  43. this._centar = value;
  44. }
  45. }
  46.  
  47.  
  48.  
  49.  
  50. }
  51. class Program
  52. {
  53. static void Main(string[] args)
  54. {
  55. double x,y;
  56. x = Convert.ToDouble(Console.ReadLine());
  57. y = Convert.ToDouble(Console.ReadLine());
  58. Tacka t = new Tacka(x, y);
  59.  
  60. }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement