Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace ConsoleApp4
  6. {
  7. class User
  8. {
  9. private string name;
  10. private string surname;
  11. private string patronymic;
  12.  
  13. private int age;
  14. double error;
  15.  
  16.  
  17.  
  18.  
  19.  
  20. public String Name
  21. {
  22. set
  23. {
  24. name = value;
  25. }
  26. get
  27. {
  28. if (String.IsNullOrEmpty(name) || double.TryParse(name, out error))
  29. {
  30. Console.Write(" This is not name! ");
  31. return name = "undifined";
  32. }
  33. else
  34. return name;
  35. }
  36. }
  37. public String Surname
  38. {
  39.  
  40. set
  41. {
  42. surname = value;
  43. }
  44. get
  45. {
  46. if (String.IsNullOrEmpty(surname) || double.TryParse(name, out error))
  47. {
  48. Console.Write(" This is not surname! ");
  49. return surname = "undifined";
  50. }
  51. return surname;
  52. }
  53. }
  54.  
  55. public String Patronymic
  56. {
  57. set
  58. {
  59. patronymic = value;
  60. }
  61. get
  62. {
  63. if (String.IsNullOrEmpty(patronymic) || double.TryParse(name, out error))
  64. {
  65. Console.Write(" This is not patronymic! ");
  66. return patronymic = "undifined";
  67. }
  68. else
  69. return patronymic;
  70. }
  71. }
  72.  
  73.  
  74. public int Age
  75. {
  76. set
  77. {
  78. age = value;
  79. }
  80. get
  81. {
  82. if (age < 18)
  83. {
  84. Console.Write(" (this user is peezduk!) ");
  85. return age;
  86. }
  87. else return age;
  88. }
  89. }
  90.  
  91.  
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement