Question: Write a program in C#, and create the class Car, having 6 private fields, and 6 public Proprieties, public overloaded 2 Constructors (default and one
Write a program in C\#, and create the class Car, having 6 private fields, and 6 public Proprieties, public overloaded 2 Constructors (default and one with six arguments) and a public Method void Display() to display the information about the car (use placeholders). Use the following default constructor: public Car ()//default constructor cartype = "Ford"; model = "Focus"; color = "Blue"; year = 2020; weight =1500; length =2.45; \} The set of propriety Year use the condition: if (value 2019 ) { year =2019;; In the Main() create the 4 instances (objects): Car c1, c2, c3, c4; //object c1-c4 c1= new Car(); ///instantiate the object with default constructor Console.Writeline("Display from Display() Method "+c1.Display()); Ask for the data to be entered by the user for those other car objects (c2, c3, c4). Use try and catch to control the data entries from the user. Once you have the valid data for one particular car you can use the overloaded Constructor with six arguments, or the Properties to update the information of current object data generated by the Constructor
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
