I have this code:
class Garage
{
private List <Car> cars;
public void AddCar (string carModel, string color, double speed, int yearOfIssue)
{
Car car = new Car (carModel, color, speed, yearOfIssue);
cars.Add (car);
}
public void DeleteCar (string carModel, string color, double speed, int yearOfIssue)
{
}
}
class Car
{
public Car ()
{
}
public Car (string carModel, string color, double speed, int yearOfIssue)
{
this.carModel = carModel;
this.color = color;
this.speed = speed;
this.yearOfIssue = yearOfIssue;
}
private string carModel;
private string color;
private double speed;
private int yearOfIssue;
}
In Garage class, I need to implement the DeleteCar method. So when method is calling, user enters all 4 fields or some of them, and after that the object in the List will be located and deleted, how can this be implemented and with what help?