Question: please write c# Create a new Console Application project called ImportExportApp (without quotes). In your Program.cs file, inside your ImportExportApp namespace and outside

please write c#

Create a new Console Application project called "ImportExportApp" (without quotes). In your Program.cs file, inside your ImportExportApp namespace and outside the Program class, create a new class called Car.

This class should have three public auto-implemented properties:

  • [2] CarID (int)
  • [2] Manufacturer (string)
  • [2] Model (string)

[3] In the Car class, override the ToString() method in a way that meaningful information is displayed for Car objects.

In addition, the Car class must have two static methods:

[5] 1 - SaveToFile: Saves one or more Car objects to a specified text file (i.e. Cars.txt). This method receives two parameters:

- The first is a list of Car objects to be saved (Hint: You must use lists, not arrays),

- The second is a string that represents the file name of the text file.

This method "returns" void, and writes each car object in an individual line in the text file. Each line contains the values of each property, in the following order: CarID, Manufacturer, Model. Each value should be separated by a comma "," character.

[5] 2 - LoadFromFile: Loads one or more Car objects from a specified text file (i.e. Cars.txt), which comes in the same format as specified for method SaveToFile. This method receives one parameter: A string representing the file name of the text file to be loaded.

This method returns a list of Car objects loaded from the targeted file (Hint: You must use lists, not arrays).

Once you are done, go back to the Main method in your Program.cs file, and write the test harness that fully demonstrates that your code works as per requirements. In other words:

[2] - You must invoke the SaveToFile method to write a list of car objects to your hard disk.

[2] - Then invoke the LoadFromFile method to load the data from the file you have just created.

[2] At the end, make sure to include a loop that iterates over the list of car objects you have just loaded from the file, and display their information in the Console.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!