Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CarType enum Create an enumeration named CarType to represent the types of car as follows: - SUV - Hatchback - Sedan - Truck Car Class

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
CarType enum Create an enumeration named CarType to represent the types of car as follows: - SUV - Hatchback - Sedan - Truck Car Class This class consists of the following members. All the properties have public getters and no setters. - Manufacturer : string - A string property to store manufacturer name such as "Honda" - Make : int - Model : string - A string property to store the model's name of the case such as "Civic" - VI_NUMBER : int =1021 - This is a static field help create unique Vehicle Identification Number for each car object. This number should be automatically incremented by 100 each time the constructor of this class is called. This field will be used to initialize the VIN field. - VIN : int - This is a field represents unique Vehicle Identification Number for each car object which will be initialized from VI_NUMBER field. - BasePrice : double - This property stores the base price of the car such as $35000.00 - Type : CarType - This property stores type of the car such as Sedan. It must receive value of the CarType enumeration. Define the following constructors for this class: - Car (string manufacturer, int make, string model, double basePrice, CarType type) - This constructor will assign received parameters to the respective class properties It should also increment VIN by 100 Implement the following methods in the class: - public static operator bool ==(Car first, Car second) - This method overrides the equality operator. This method will return true if the both the car objects have same manufacturer, model and type; otherwise, it returns false. This method will be used to compare two car objects. - public static operator bool !=(Car first, Car second) - This method overrides the not equality operator. This method is required by the compiler when the above method is implemented. It does the reverse of the above. This method will return false if the both the car objects have same manufacturer and model; otherwise, if either manufacturer, model or type is different, it returns true. This method is not used directly be any class. - override string ToString() this method should display all the car details in appropriate format. Dealership Cars file This text file contains the car information that each dealership should have. The file records are structured using CSV format. The following is the sample record from file: DS_22_1, Toyota,2019, Highlander, 49000.00, SUV In the record above, DS_22_1 indicates dealership ID to which the car belongs. The remaining are the car attributes which are self-explanatory. Dealership class This class consists of the following members. All the properties have public getters and no setters. - Cartist : List - This is property holds a list of cars that dealership has in stock. - ID : string - Name: string - A string property to store name of the dealership such as "The Six Dealership" - Address: string - Name: string - A string property to store name of the dealership such as "The Six Dealership" - Address: string - A string property to store the address of dealership such as "1029 Main Street, Toronto" Define the following constructors for this class: - Dealership (string ID, string name, string address) This constructor will assign received parameters to the respective class properties It will then open and read file named "Dealership_Cars.txt" which is provided with this assignment. It will read one line at a time, and extract all the fields from the records. If the first field obtained from each file record matches dealership ID provided as parameter in constructor, create an object of Car class with the help of remaining fields obtained from file record. Add the created Car class object, to the CarList variable. Implement the following methods in the class: - void ShowCars(String manufacturer) this method will display all the cars for which the manufacturer is same as the given parameter in the output. For example, ShowCars("Toyota") will show all the cars from Carlist property that has Toyota as manufacturer. - void ShowCars(Car carToBeSearched) this method will display all the cars from CarList property if the object matches the given carToBeSearched property. You will need to use == operator for this comparison. - override string ToString() this method should display all the dealership details in appropriate format. Testing To test your application, get the test harness function code provided in the attached file TestHarnes.ca, copy-paste the code to your Program class and execute. The output should like below: Testing To test your application, get the test harness function code provided in the attached file TestHarnes.ca, copy-paste the code to your Program class and execute. The output should like below: ablic elas: Progran

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

Students also viewed these Databases questions

Question

Find y'. y= |x + X (x) (x) X 1 02x+ 2x 1 O 2x + 1/3 Ex 2x +

Answered: 1 week ago