Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace CryptoMiningSystem.Entities
- {
- using CryptoMiningSystem.Entities.Contracts;
- using CryptoMiningSystem.Utilities;
- using System;
- using System.Text;
- public class User : IUser
- {
- private string name;
- private int stars;
- private decimal money;
- private Computer computer;
- public User(string name, decimal money)
- {
- this.Name = name;
- this.Money = money;
- this.Stars = (int)money / 100;
- this.Computer = computer;
- }
- public string Name
- {
- get
- {
- return this.name;
- }
- set
- {
- if (value == null || value.Remove(' ') == "")
- {
- throw new ArgumentException("Username must not be null or empty!");
- }
- this.name = value;
- }
- }
- public int Stars
- {
- get
- {
- return this.stars;
- }
- set
- {
- this.stars = value;
- }
- }
- public decimal Money
- {
- get
- {
- return this.money;
- }
- set
- {
- if (value < 0)
- {
- throw new ArgumentException("User's money cannot be less than 0!");
- }
- this.money = value;
- }
- }
- public Computer Computer
- {
- get
- {
- return this.computer;
- }
- set
- {
- this.computer = value;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement