Advertisement
elena1234

CarSalesman- class Engine

Feb 8th, 2021 (edited)
952
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. namespace CarSalesman
  2. {
  3.     public class Engine
  4.     {
  5.         public Engine(string model, string power)
  6.         {
  7.             this.Model = model;
  8.             this.Power = power;
  9.             this.Displacement = null;
  10.             this.Efficiency = "n/a";
  11.         }
  12.  
  13.         public Engine(string model, string power, int displacement)
  14.            : this(model, power)
  15.         {
  16.             this.Displacement = displacement;
  17.         }
  18.  
  19.         public Engine(string model, string power, string efficiency)
  20.           : this(model, power)
  21.         {
  22.             this.Efficiency = efficiency;
  23.         }
  24.  
  25.         public Engine(string model, string power, int displacement, string efficiency)
  26.             : this(model, power)
  27.         {
  28.             this.Displacement = displacement;
  29.             this.Efficiency = efficiency;
  30.         }
  31.  
  32.         public string Model { get; set; }
  33.         public string Power { get; set; }
  34.         public int? Displacement { get; set; }
  35.         public string Efficiency { get; set; }
  36.     }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement