Advertisement
Guest User

Car Class

a guest
Oct 30th, 2021
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace SoftUniParking
  6. {
  7. public class Car
  8. {
  9. public string Make { get; set; }
  10. public string Model { get; set; }
  11. public int HorsePower { get; set; }
  12. public string RegistrationNumber { get; set; }
  13.  
  14.  
  15. public Car(string make, string model, int horsePower, string registrationNumber)
  16. {
  17. this.Make = make;
  18. this.Model = model;
  19. this.HorsePower = horsePower;
  20. this.RegistrationNumber = registrationNumber;
  21. }
  22.  
  23.  
  24. public override string ToString()
  25. {
  26. string result = $"Make: {this.Make}" + Environment.NewLine;
  27. result += $"Model: {this.Model}" + Environment.NewLine;
  28. result += $"HorsePower: {this.HorsePower}" + Environment.NewLine;
  29. result += $"RegistrationNumber: {this.RegistrationNumber}";
  30. return result;
  31. }
  32.  
  33.  
  34. }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement