using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CarManagerV2 { public class Car { int id; string make; string model; int year; string color; int mileage; decimal price; int order; public Car(int id, string make, string model, int year, string color, int mileage, decimal price, int order = 0) { this.id = id; this.make = make; this.model = model; this.year = year; this.color = color; this.mileage = mileage; this.price = price; this.order = order; } public int Id { get { return id; } set { id = value; } } public string Make { get { return make; } set { make = value; } } public string Model { get { return model; } set { model = value; } } public int Year { get { return year; } set { year = value; } } public string Color { get { return color; } set { color = value; } } public int Mileage { get { return mileage; } set { mileage = value; } } public decimal Price { get { return price; } set { price = value; } } public int Order { get { return order; } set { order = value; } } public override string ToString() { return $"{make} {model} ({year})"; } public string ToCsvString() { return $"{id};{make};{model};{year};{color};{mileage};{price}"; } public static Car FromCsvString(string csv) { string[] parts = csv.Split(';'); return new Car(int.Parse(parts[0]), parts[1], parts[2], int.Parse(parts[3]), parts[4], int.Parse(parts[5]), decimal.Parse(parts[6])); } public bool IsChanged(Car other) { return make != other.make || model != other.model || year != other.year || color != other.color || mileage != other.mileage || price != other.price || other.color != color; } public Car Clone() { return new Car(id, make, model, year, color, mileage, price); } } }