Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 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 ConsoleApplication1
  8. {
  9.  
  10.  
  11. class Show
  12. {
  13.  
  14. int showId;
  15. int roomId;
  16. string languageVersion;
  17. int day;
  18. int mounth;
  19. double hour;
  20.  
  21. public Show()
  22. {
  23. showId = 0;
  24. roomId = 0;
  25. languageVersion = "";
  26. day = 0;
  27. mounth = 0;
  28. hour = 0;
  29. }
  30.  
  31. public Show ( int _showId, int _roomId, string _languageVersion, int _day,int _mounth, float _hour)
  32. {
  33. showId = _showId;
  34. roomId = _roomId;
  35. languageVersion = _languageVersion;
  36. day = _day;
  37. mounth = _mounth;
  38. hour = _hour;
  39. }
  40.  
  41. public Show setShowId (int _showId)
  42. {
  43. if (_showId > 99999 && _showId < 1000000)
  44. {
  45. showId = _showId;
  46. return this;
  47. }else
  48. throw new System.ArgumentException("Wrong showId");
  49.  
  50. }
  51.  
  52. public Show setRoomId (int _roomId)
  53. {
  54. if (_roomId > 99999 && _roomId < 1000000)
  55. {
  56. roomId = _roomId;
  57. return this;
  58. }else
  59. throw new System.ArgumentException("Wrong roomId");
  60. }
  61.  
  62. public Show setlanguageVersion(string _languageVersion)
  63. {
  64. if (_languageVersion.Length < 50){
  65. languageVersion = _languageVersion;
  66. return this;
  67. }else
  68. throw new System.ArgumentException("Wrong language version");
  69. }
  70.  
  71. public Show setDay(int _day)
  72. {
  73. if (_day > 0 && _day < 32)
  74. {
  75. day = _day;
  76. return this;
  77. }else
  78. throw new System.ArgumentException("Wrong day");
  79. }
  80.  
  81. public Show setMounth(int _mounth)
  82. {
  83. if (_mounth > 0 && _mounth < 13)
  84. {
  85. mounth = _mounth;
  86. return this;
  87. }else
  88. throw new System.ArgumentException("Wrong mounth");
  89. }
  90.  
  91. public Show setHour(double _hour)
  92. {
  93. if (_hour >= 0.0 && _hour < 23.59)
  94. {
  95. hour = _hour;
  96. return this;
  97. }
  98. throw new System.ArgumentException("Wrong hour");
  99. }
  100.  
  101. public int getShowId()
  102. {
  103. return showId;
  104. }
  105.  
  106. public int getRoomId()
  107. {
  108. return roomId;
  109. }
  110.  
  111. public string getLanguageVersion()
  112. {
  113. return languageVersion;
  114. }
  115.  
  116. public int getDay()
  117. {
  118. return day;
  119. }
  120.  
  121. public int getMounth()
  122. {
  123. return mounth;
  124. }
  125.  
  126. public double getHour()
  127. {
  128. return hour;
  129. }
  130. }
  131.  
  132. class Room
  133. {
  134. int roomId;
  135. string roomName;
  136. int seatsAmount;
  137.  
  138. public Room()
  139. {
  140. roomId = 0;
  141. roomName = "";
  142. seatsAmount = 0;
  143. }
  144.  
  145. public Room(int _roomId, string _roomName, int _seatsAmount)
  146. {
  147. roomId = _roomId;
  148. roomName = _roomName;
  149. seatsAmount = _seatsAmount;
  150. }
  151.  
  152. public Room setRoomId( int _roomId)
  153. {
  154. if( _roomId > 99999 && _roomId < 1000000)
  155. {
  156. roomId = _roomId;
  157. return this;
  158. }else
  159. throw new System.ArgumentException("Wrong room Id");
  160. }
  161.  
  162. public Room setRoomName( string _roomName)
  163. {
  164. if (roomName.Length < 50)
  165. {
  166. roomName = _roomName;
  167. return this;
  168. }else
  169. throw new System.ArgumentException("Wrong room ame");
  170. }
  171.  
  172. public Room setSeatsAmount(int _seatsAmount)
  173. {
  174. if (_seatsAmount > 11 && _seatsAmount < 50)
  175. {
  176. seatsAmount = _seatsAmount;
  177. return this;
  178. }else
  179. throw new System.ArgumentException("Wrong seats amount");
  180. }
  181.  
  182. public int getRoomId()
  183. {
  184. return roomId;
  185. }
  186.  
  187. public string getRoomName()
  188. {
  189. return roomName;
  190. }
  191.  
  192. public int getSeatsAmount()
  193. {
  194. return seatsAmount;
  195. }
  196. }
  197.  
  198.  
  199. class Program
  200. {
  201. static void Main(string[] args)
  202. {
  203. Show show1 = new Show();
  204. show1.setShowId(123456).setRoomId(654321)
  205. .setlanguageVersion("ENGLISH")
  206. .setDay(5)
  207. .setMounth(8)
  208. .setHour(12.35);
  209.  
  210. Room room1 = new Room();
  211. room1.setRoomId(111111)
  212. .setRoomName("Room4Hoorros")
  213. .setSeatsAmount(35);
  214.  
  215. Console.WriteLine(show1.getLanguageVersion());
  216. Console.WriteLine(room1.getRoomId());
  217.  
  218. Console.ReadKey();
  219.  
  220. }
  221. }
  222. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement