Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. namespace CryptoMiningSystem.Entities
  2. {
  3. using CryptoMiningSystem.Entities.Contracts;
  4. using CryptoMiningSystem.Utilities;
  5. using System;
  6. using System.Text;
  7.  
  8. public class User : IUser
  9. {
  10. private string name;
  11. private int stars;
  12. private decimal money;
  13. private Computer computer;
  14.  
  15. public User(string name, decimal money)
  16. {
  17. this.Name = name;
  18. this.Money = money;
  19. this.Stars = (int)money / 100;
  20. this.Computer = computer;
  21.  
  22.  
  23. }
  24. public string Name
  25. {
  26. get
  27. {
  28. return this.name;
  29. }
  30. set
  31. {
  32. if (value == null || value.Remove(' ') == "")
  33. {
  34. throw new ArgumentException("Username must not be null or empty!");
  35. }
  36. this.name = value;
  37. }
  38. }
  39.  
  40. public int Stars
  41. {
  42. get
  43. {
  44. return this.stars;
  45. }
  46. set
  47. {
  48. this.stars = value;
  49. }
  50. }
  51.  
  52. public decimal Money
  53. {
  54. get
  55. {
  56. return this.money;
  57. }
  58. set
  59. {
  60. if (value < 0)
  61. {
  62. throw new ArgumentException("User's money cannot be less than 0!");
  63. }
  64. this.money = value;
  65. }
  66. }
  67.  
  68. public Computer Computer
  69. {
  70. get
  71. {
  72. return this.computer;
  73. }
  74. set
  75. {
  76.  
  77. this.computer = value;
  78. }
  79. }
  80. }
  81.  
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement