Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a windows application in C# Add a class Car with following fields: privat

ID: 3592819 • Letter: C

Question

Create a windows application in C#

Add a class Car with following fields:

       private string _make;

        private string _model;

        private int _mileage;

        private int _year;

        private decimal _price;

        private string _engineSize; //like 2.4L V4, 3.8L V8

        private int _averageMpg;

        private int _customerID;

Add necessary constructor and properties

Add a method ‘LowerPriceBy(decimal percent), where percent is a number in the form of x%, like 2%, 3.5% and so on.     

Formula is _price -= percent*price/100;

Add a class SportCar that inherits from Car. The SportCar should have an additional field: _zeroToSixty (in seconds)

Add a class Truck that inherits from Car as well. The Truck should have an additional field: maxTowing (like: 12000 lbs)

In Form1, create a List of cars to hold all the cars, sportcars and trucks

In Form1_Load, add at least 10 cars, 10 sportcars, and 10 trucks

(try to add them randomly, by that I mean avoid adding 10 cars, followed by 10 sportcars and so on, instead interleave them. Also a customerID may be the same in 2 or more cars,sportscar, and/or trucks. That allows a customer to own more than one vehicle.

Add a method ‘DisplayCars’ that takes a list of cars and display the list in a listview,then add a button to display all the cars in the cars list.

Add a method GetMostExpensiveCar(…). This method should take a car list and return the most expensive car. Add a button that calls the method and display the most expensive car.

Add a method ‘GetCarsByMake(….)’. This method takes a car make and returns a list of cars of the given make. Add a button to call the method, pass to it a car make from user input and display the results

Add a method ‘GetCarsByCustomerID(….)’. This method takes a customerID and returns a list of cars owned by this customer. Add a button to call the method, pass to it a customerID from user input, then display the results.

Add a method ‘GetCarsByType(….)’. This method takes the type of car, example: Car, SportCar, Truck, and returns a list of cars of the given type

Provide a textbox or combobox for the user to enter a type. Add a button to call this method and display its results

Explanation / Answer

private string _make;

        private string _model;

        private int _mileage;

        private int _year;

        private decimal _price;

        private string _engineSize; //like 2.4L V4, 3.8L V8

        private int _averageMpg;

        private int _customerID;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote