Advertisement
dobroslav-atanasov

Untitled

Feb 16th, 2018
423
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 KB | None | 0 0
  1. namespace CarSalesman
  2. {
  3.     public class Car
  4.     {
  5.         private string model;
  6.         private Engine engine;
  7.         private string newEngine;
  8.         private int weight;
  9.         private string color;
  10.  
  11.         public string Color
  12.         {
  13.             get { return color; }
  14.             set { this.color = value; }
  15.         }
  16.  
  17.         public string NewEngine
  18.         {
  19.             get { return newEngine; }
  20.             set { this.newEngine = value; }
  21.         }
  22.  
  23.         public Engine Engine
  24.         {
  25.             get { return engine; }
  26.             set { this.engine = value; }
  27.         }
  28.  
  29.         public string Model
  30.         {
  31.             get { return model; }
  32.             set { this.model = value; }
  33.         }
  34.  
  35.         public int Weight
  36.         {
  37.             get { return weight; }
  38.             set { this.weight = value; }
  39.         }
  40.  
  41.         public Car(string carModel, Engine inputEngine)
  42.             : this(carModel, inputEngine, 0, "n/a")
  43.         {
  44.         }
  45.  
  46.         public Car(string carModel, Engine inputEngine, string color)
  47.             : this(carModel, inputEngine, 0, color)
  48.  
  49.         {
  50.         }
  51.  
  52.         public Car(string carModel, Engine inputEngine, int weight)
  53.             : this(carModel, inputEngine, weight, "n/a")
  54.         {
  55.         }
  56.  
  57.         public Car(string carModel, Engine inputEngine, int weight, string color)
  58.         {
  59.             this.model = carModel;
  60.             this.engine = inputEngine;
  61.             this.weight = weight;
  62.             this.color = color;
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement