Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. private double fuelQuantity;
  2.  
  3. public double FuelQuantity
  4. {
  5. get
  6. {
  7. return this.fuelQuantity;
  8. }
  9.  
  10. private set
  11. {
  12. if (value <= this.TankCapacity)
  13. {
  14. this.fuelQuantity = value;
  15. }
  16. else
  17. {
  18. this.fuelQuantity = 0;
  19. }
  20. }
  21. }
  22.  
  23. public double FuelConsumption { get; private set; }
  24.  
  25. public double TankCapacity { get; set; }
  26.  
  27.  
  28. public Vehicle(double fuelQuantity, double fuelConsumtpion, double tankCapacity)
  29. {
  30. this.FuelQuantity = fuelQuantity;
  31. this.FuelConsumption = fuelConsumtpion;
  32. this.TankCapacity = tankCapacity;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement