Advertisement
elena1234

SoftUniParking- class car

Feb 9th, 2021
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System.Text;
  2.  
  3. namespace SoftUniParking
  4. {
  5.     public class Car
  6.     {
  7.         public Car(string make,string model,int horsePower,string registrationNumber)
  8.         {
  9.             this.Make = make;
  10.             this.Model = model;
  11.             this.HorsePower = horsePower;
  12.             this.RegistrationNumber = registrationNumber;              
  13.         }
  14.  
  15.         public string Make { get; set; }
  16.         public string Model { get; set; }
  17.         public int HorsePower { get; set; }
  18.         public string RegistrationNumber { get; set; }
  19.  
  20.         public override string ToString()
  21.         {
  22.             StringBuilder sb = new StringBuilder();
  23.             sb.AppendLine($"Make: {this.Make}");
  24.             sb.AppendLine($"Model: {this.Model}");
  25.             sb.AppendLine($"HorsePower: {this.HorsePower}");
  26.             sb.AppendLine($"RegistrationNumber: {this.RegistrationNumber}");
  27.             return sb.ToString().Trim();
  28.         }
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement